/* Use local/system fonts in production to avoid external font load failures. */

:root {
  --bg: #0a0f1f;
  --bg-deep: #060b16;
  --surface: rgba(13, 19, 35, 0.92);
  --surface-strong: rgba(12, 18, 34, 0.98);
  --surface-glass: rgba(12, 18, 34, 0.72);
  --sidebar-bg: rgba(8, 12, 24, 0.95);
  --sidebar-glow: rgba(0, 229, 255, 0.18);
  --topbar-bg: rgba(8, 12, 24, 0.92);
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --text-invert: #e2e8f0;
  --primary: #00e5ff;
  --primary-strong: #18b8ff;
  --primary-soft: rgba(0, 229, 255, 0.14);
  --accent: #22c55e;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --border: rgba(148, 163, 184, 0.22);
  --shadow: 0 24px 46px rgba(1, 4, 12, 0.72);
  --shadow-soft: 0 16px 32px rgba(1, 5, 14, 0.6);
  --glow: 0 0 0 1px rgba(0, 229, 255, 0.3), 0 0 24px rgba(0, 229, 255, 0.2);
  --radius: 18px;
  --radius-sm: 12px;
  --font-body: "Exo 2", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Orbitron", "Exo 2", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

input,
select,
textarea,
button {
  font-family: var(--font-body);
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 229, 255, 0.12), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(34, 197, 94, 0.1), transparent 55%);
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

body.customer-safe {
  background-image: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.35;
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: -25% -10% 0 -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 229, 255, 0.18), transparent 45%),
    radial-gradient(circle at 70% 10%, rgba(59, 130, 246, 0.16), transparent 42%),
    radial-gradient(circle at 85% 70%, rgba(34, 197, 94, 0.12), transparent 48%);
  opacity: 0.6;
  pointer-events: none;
  z-index: -1;
}

body.customer-safe::before,
body.customer-safe::after {
  content: none;
  display: none;
}

body.customer-safe * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

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

.page-customer,
.page-login {
  position: relative;
  z-index: 1;
}

.page-customer {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  max-height: 100vh;
  background: linear-gradient(180deg, rgba(10, 16, 30, 0.98), rgba(8, 12, 24, 0.98));
  color: var(--text-invert);
  padding: 22px 16px;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  align-self: flex-start;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar toggle button (inside topbar) */
.sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 0;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--primary);
}

.sidebar-toggle svg {
  transition: transform 0.28s ease;
}

.sidebar.is-collapsed ~ .main .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Collapsed sidebar */
.sidebar.is-collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  border-right-color: transparent;
}

.sidebar.is-collapsed .brand,
.sidebar.is-collapsed nav {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, var(--sidebar-glow), transparent 55%);
  opacity: 0.8;
  pointer-events: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 155, 255, 0.28);
  background: rgba(8, 14, 28, 0.7);
  box-shadow: 0 16px 28px rgba(3, 7, 18, 0.45);
  margin-bottom: 22px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: #e6f3ff;
}

.brand-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.brand-meta {
  margin-top: 4px;
  font-size: 10px;
  color: var(--primary);
  letter-spacing: 1.8px;
}

.nav-section + .nav-section {
  margin-top: 16px;
}

.nav-section-title {
  font-size: 11px;
  color: var(--text-soft);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: #d0d7e2;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-item a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.nav-item.active a,
.nav-item a:hover {
  background: rgba(31, 155, 255, 0.14);
  color: #ffffff;
  border-color: rgba(31, 155, 255, 0.35);
  box-shadow: var(--glow);
}

.nav-item.active a::before,
.nav-item a:hover::before {
  background: var(--primary);
  box-shadow: 0 0 12px rgba(31, 155, 255, 0.9);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: var(--topbar-bg);
  color: var(--text-invert);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.topbar-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--text-strong);
}

.topbar-user {
  font-size: 12px;
  color: var(--text-invert);
}

.topbar-user a {
  color: var(--text-invert);
  margin-left: 10px;
  font-weight: 500;
}

.page {
  padding: 24px 28px 32px;
  display: grid;
  gap: 16px;
  position: relative;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.page > * {
  animation: rise 0.55s ease both;
}

.page > *:nth-child(1) {
  animation-delay: 0.05s;
}

.page > *:nth-child(2) {
  animation-delay: 0.1s;
}

.page > *:nth-child(3) {
  animation-delay: 0.15s;
}

.page > *:nth-child(4) {
  animation-delay: 0.2s;
}

.page-heading {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.4px;
}

.page-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(31, 155, 255, 0.4), transparent);
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-hero .page-heading::after {
  display: none;
}

.page-subtitle {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 720px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.toolbar-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
  font-size: 12px;
  color: var(--text);
}

.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  box-shadow: var(--glow);
  border-color: rgba(31, 155, 255, 0.6);
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-strong);
  transition: box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  box-shadow: var(--shadow-soft);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(31, 155, 255, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 16px 30px rgba(31, 155, 255, 0.35);
}

.btn-outline {
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--primary);
  background: rgba(0, 229, 255, 0.08);
}

.btn-outline:hover {
  background: rgba(0, 229, 255, 0.14);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 12px 24px rgba(244, 63, 94, 0.35);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
  height: auto;
  min-height: 28px;
}

.link {
  color: var(--primary-strong);
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.table th,
.table td {
  padding: 10px 12px;
  font-size: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: linear-gradient(90deg, rgba(31, 155, 255, 0.14), rgba(45, 212, 191, 0.08));
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.3px;
}

/* Horizontal scroll wrapper for wide tables */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Fixed-layout table for many-column pages */
.table-fixed {
  table-layout: fixed;
  min-width: 720px;
}

/* Truncated cell content with native tooltip */
.cell-truncate {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.table tbody tr:hover td {
  background: rgba(31, 155, 255, 0.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge.strong {
  background: rgba(0, 229, 255, 0.18);
  color: var(--primary);
  border-color: rgba(0, 229, 255, 0.4);
}

.card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card .table {
  box-shadow: none;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text-strong);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.8fr) minmax(0, 1fr);
  gap: 18px;
}

.stacked-cards {
  display: grid;
  gap: 16px;
}

.split-layout > * {
  min-width: 0;
}

.stacked-cards > * {
  min-width: 0;
}

.agent-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.agent-summary-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--shadow-soft);
}

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

.agent-summary-item strong {
  font-size: 14px;
  color: var(--text-strong);
  font-weight: 700;
}

.agent-single-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.85fr);
  align-items: start;
}

.agent-config-card textarea {
  min-height: 360px;
}

.agent-readonly-field {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-strong);
  font-size: 12px;
}

.agent-config-note {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(31, 155, 255, 0.08);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.acq-monitor-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(400px, 0.95fr);
  align-items: start;
}

.acq-monitor-layout .table-scroll {
  width: 100%;
  max-width: 100%;
}

.acq-monitor-sidebar {
  position: relative;
}

.acq-monitor-strategy-card {
  position: sticky;
  top: 88px;
}

.acq-monitor-sidebar .form-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.acq-monitor-sidebar .form-row label {
  min-width: 0;
  padding-top: 8px;
}

.acq-monitor-sidebar .form-row > div,
.acq-monitor-sidebar .form-row > input,
.acq-monitor-sidebar .form-row > select,
.acq-monitor-sidebar .form-row > textarea {
  min-width: 0;
  width: 100%;
}

.gewe-login-result {
  display: grid;
  gap: 12px;
}

.gewe-qr-wrap {
  display: flex;
  justify-content: center;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 12px;
  padding: 12px;
}

.gewe-qr-wrap img {
  width: 100%;
  max-width: 180px;
  height: auto;
}

.gewe-login-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

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

.form-grid {
  display: grid;
  gap: 12px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

.form-row label {
  min-width: 90px;
  color: var(--text-muted);
}

.form-row > div {
  flex: 1;
  color: var(--text-strong);
}

.form-field-stack {
  display: grid;
  gap: 6px;
}

.form-row input,
.form-row select {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
}

.form-row select[multiple] {
  height: auto;
  min-height: 92px;
  padding: 8px 12px;
}

.form-row input.input-wide-code {
  flex: 1 1 720px;
  min-width: min(96vw, 720px);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.form-row textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-body);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: rgba(31, 155, 255, 0.6);
  box-shadow: var(--glow);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
}

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

.radio-group {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.agent-preview-card textarea {
  min-height: 118px;
}

.agent-preview-status {
  min-height: 18px;
  display: inline-flex;
  align-items: center;
}

.agent-preview-result {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  font-size: 12px;
}

.agent-preview-result.is-empty,
.agent-preview-result.is-loading {
  color: var(--text-muted);
}

.agent-preview-result.is-error {
  border-color: rgba(244, 63, 94, 0.32);
  background: rgba(244, 63, 94, 0.08);
  color: var(--danger);
}

.agent-preview-result.is-warning {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
}

.agent-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-preview-reply {
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--text-strong);
}

.agent-preview-snippets {
  display: grid;
  gap: 8px;
}

.agent-preview-snippet {
  padding-left: 10px;
  border-left: 2px solid var(--primary);
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.inline-form select {
  min-width: 110px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 6px;
}

.account-console {
  align-items: flex-start;
}

.account-batch-card {
  background:
    linear-gradient(135deg, rgba(31, 155, 255, 0.1), rgba(45, 212, 191, 0.05)),
    var(--surface-glass);
}

.account-batch-form {
  display: grid;
  gap: 14px;
}

.account-batch-card .form-actions {
  justify-content: flex-start;
}

.account-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.account-checkbox-pill {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.05);
  cursor: pointer;
}

.account-checkbox-pill input {
  margin-top: 2px;
}

.account-checkbox-pill span {
  display: grid;
  gap: 4px;
}

.account-checkbox-pill strong {
  font-size: 12px;
  color: var(--text-strong);
}

.account-checkbox-pill small {
  font-size: 11px;
  color: var(--text-muted);
}

.account-side-card {
  position: sticky;
  top: 96px;
}

.account-action-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.account-password-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-password-row input {
  flex: 1;
  min-width: 0;
}

.account-inline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-linked-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

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

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-strong);
}

.stat-meta {
  font-size: 11px;
  color: var(--text-soft);
}

.wechat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.wechat-account-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 6px;
}

.wechat-account-card.empty {
  color: var(--text-muted);
  text-align: center;
}

.wechat-account-card.bound {
  border-color: rgba(34, 197, 94, 0.3);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, var(--surface-strong) 100%);
}

.wechat-account-card.unbound {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, var(--surface-strong) 100%);
  opacity: 0.85;
}

.binding-status {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.binding-status.bound {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.binding-status.unbound {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.binding-status.conflict {
  background: rgba(244, 63, 94, 0.15);
  color: #dc2626;
}

/* 绑定警告 Toast */
.binding-warning-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(251, 191, 36, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.binding-warning-toast .warning-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: #d97706;
}

.binding-warning-toast .warning-content {
  flex: 1;
}

.binding-warning-toast .warning-title {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 4px;
}

.binding-warning-toast .warning-message {
  font-size: 12px;
  color: #b45309;
  line-height: 1.5;
}

.binding-warning-toast .warning-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  font-size: 18px;
  color: #d97706;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.binding-warning-toast .warning-close:hover {
  opacity: 1;
}

.wechat-account-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

.wechat-account-meta {
  font-size: 11px;
  color: var(--text-soft);
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(520px, 2.4fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.chat-layout.wechat-layout {
  grid-template-columns: minmax(280px, 1.15fr) minmax(560px, 2.7fr) minmax(260px, 1fr);
}

.chat-list-card,
.chat-main,
.chat-aside {
  min-width: 0;
}

.chat-list-header,
.chat-aside-header,
.chat-main-header {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-strong);
}

.chat-list-body {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.chat-list-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-list-search input {
  flex: 1;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.04);
}

.chat-item a {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.03);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  min-width: 0;
}

.chat-item.active a,
.chat-item a:hover {
  border-color: rgba(31, 155, 255, 0.4);
  background: rgba(31, 155, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(31, 155, 255, 0.18);
  color: var(--primary-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

.chat-avatar.large {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 14px;
}

.chat-item-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.chat-item-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-strong);
}

.chat-item-wechat-id {
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.chat-item-time {
  font-size: 10px;
  color: var(--text-soft);
  white-space: nowrap;
  text-align: right;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.sync-status {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 12px;
}

.sync-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sync-status-title {
  font-size: 12px;
  font-weight: 600;
}

.sync-status-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text-soft);
}

.sync-status-inline {
  margin-top: 8px;
  margin-bottom: 0;
}

.sync-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.sync-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
  transition: width 0.2s ease;
}

.message-status {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-soft);
}

.message-status.pending {
  background: rgba(255, 196, 0, 0.15);
  color: #d97706;
}

.message-status.error {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
}

.message-status.success {
  background: rgba(34, 197, 94, 0.16);
  color: #22c55e;
}

.message-status.cancelled {
  background: rgba(100, 116, 139, 0.18);
  color: #94a3b8;
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.chat-header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-header-left > div {
  min-width: 0;
}

.chat-header-info {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 4px;
}

.chat-header-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.chat-header-meta {
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-last-message {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.45;
  word-break: break-word;
}

.chat-header-wechat-id {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  max-width: min(44%, 320px);
  min-width: 180px;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-header-statuses {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-header-statuses .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header .chat-avatar {
  flex: 0 0 auto;
}

.chat-header-sync-warning {
  margin-top: -2px;
  margin-bottom: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.1);
  color: #be123c;
  font-size: 11px;
}

.chat-messages {
  flex: 1;
  min-height: 320px;
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  padding-right: 6px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.08), transparent 35%),
    linear-gradient(180deg, rgba(6, 11, 22, 0.36), rgba(10, 16, 30, 0.2));
}

.chat-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-message.agent {
  flex-direction: row-reverse;
  text-align: right;
}

.chat-message-body {
  display: grid;
  gap: 4px;
  max-width: min(76%, 620px);
}

.chat-message.agent .chat-message-body {
  align-items: flex-end;
}

.chat-message.agent .chat-meta {
  text-align: right;
}

.chat-message .chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  color: #0f172a;
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: var(--shadow-soft);
  word-break: break-word;
}

.chat-message.agent .chat-bubble {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #14532d;
  border-color: rgba(34, 197, 94, 0.3);
}

.chat-message.customer .chat-bubble {
  background: #f8fafc;
  color: #0f172a;
}

.chat-message .chat-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-input {
  display: grid;
  gap: 8px;
}

.chat-input textarea {
  resize: vertical;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-body);
  background: rgba(15, 23, 42, 0.55);
  color: #f8fafc;
  caret-color: #f8fafc;
}

.chat-input textarea::placeholder {
  color: rgba(226, 232, 240, 0.75);
  opacity: 1;
}

.chat-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.chat-aside {
  display: grid;
  gap: 12px;
}

.chat-aside .aside-block {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(31, 155, 255, 0.22);
  background: rgba(31, 155, 255, 0.08);
  color: var(--text-strong);
  font-size: 11px;
  line-height: 1;
}

.tag-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.tag-chip-remove:hover {
  color: var(--primary-strong);
}

.tag-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.tag-input-row input {
  flex: 1;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.04);
}

.interaction-input-row {
  display: grid;
  gap: 10px;
}

.interaction-input-row textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  line-height: 1.5;
}

.interaction-input-row textarea:focus,
.tag-input-row input:focus {
  outline: none;
  box-shadow: var(--glow);
  border-color: rgba(31, 155, 255, 0.6);
}

.aside-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-strong);
}

.aside-content {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

.placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
}

.toast-stack {
  display: grid;
  gap: 8px;
}

.toast {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.toast-error {
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--danger);
}

.toast-info {
  border-color: rgba(31, 155, 255, 0.4);
  color: var(--primary-strong);
}

.page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(10, 16, 30, 0.98), rgba(6, 10, 20, 0.98));
}

.page-login::before,
.page-login::after {
  opacity: 0.2;
}

.page-login .main {
  width: 100%;
}

.page-login .page {
  padding: 0;
}

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 36px 44px;
  width: min(1024px, 95vw);
  background: rgba(12, 20, 38, 0.6);
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow);
  color: var(--text-invert);
  backdrop-filter: blur(14px);
}

.login-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-hero h1 {
  margin: 0;
  font-size: 28px;
  font-family: var(--font-display);
  color: #e6f3ff;
  letter-spacing: 0.6px;
}

.login-hero .hero-image {
  width: 100%;
  min-height: 250px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(31, 155, 255, 0.25), rgba(45, 212, 191, 0.25));
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.4);
  position: relative;
  overflow: hidden;
}

.login-hero .hero-image::before,
.login-hero .hero-image::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.login-hero .hero-image::before {
  width: 180px;
  height: 180px;
  right: -42px;
  top: -36px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.24), transparent 68%);
}

.login-hero .hero-image::after {
  width: 220px;
  height: 220px;
  left: -70px;
  bottom: -110px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.24), transparent 68%);
}

.login-hero .hero-image img {
  width: min(70%, 220px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.35));
}

.hero-wordmark > * {
  position: relative;
  z-index: 1;
}

.hero-wordmark-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.82);
}

.hero-wordmark-kicker::before {
  content: "";
  width: 32px;
  height: 1px;
  background: currentColor;
  opacity: 0.78;
}

.hero-wordmark-name {
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1;
  letter-spacing: 0.12em;
  color: #f8fbff;
  text-shadow: 0 16px 32px rgba(15, 23, 42, 0.28);
}

.hero-wordmark-sub {
  max-width: 280px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(226, 232, 240, 0.86);
}

.hero-wordmark-compact .hero-wordmark-name {
  font-size: clamp(36px, 6vw, 56px);
}

.login-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 28px;
  color: var(--text-invert);
  box-shadow: var(--shadow-soft);
}

.login-card h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.login-tabs {
  display: flex;
  gap: 18px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-tabs span,
.login-tabs button {
  position: relative;
  padding-bottom: 6px;
  color: rgba(226, 232, 240, 0.7);
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  padding-left: 0;
  padding-right: 0;
}

.login-tabs .active {
  color: #ffffff;
}

.login-tabs .active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.form input {
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 0 10px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.form input:focus {
  outline: none;
  box-shadow: var(--glow);
  border-color: rgba(31, 155, 255, 0.6);
}

.page-login .form input::placeholder {
  color: rgba(226, 232, 240, 0.6);
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.captcha-row .btn {
  height: 34px;
}

.login-card .btn-primary {
  margin-top: 8px;
  width: 140px;
}

.login-support {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
  font-size: 12px;
  color: rgba(226, 232, 240, 0.75);
  display: grid;
  gap: 4px;
}

.login-support .support-title {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Collapsible panel */
.is-collapsed {
  display: none;
}

/* Table actions */
.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.table-actions form {
  margin: 0;
  display: inline-flex;
}

/* Badge variants */
.badge-success {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.16);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.35);
}

.badge-warn {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

/* Button variants */
.btn-warn-outline {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
}

.btn-warn-outline:hover {
  background: rgba(245, 158, 11, 0.14);
}

/* Upload zone */
.upload-zone {
  margin: 0;
}

.upload-zone-inner {
  border: 2px dashed rgba(0, 229, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.upload-zone-inner:hover,
.upload-zone-inner.drag-over {
  border-color: var(--primary);
  background: rgba(0, 229, 255, 0.05);
}

.upload-icon {
  color: var(--primary);
  margin-bottom: 10px;
  opacity: 0.7;
}

.upload-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 4px;
}

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

.upload-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.upload-file-info {
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  font-size: 12px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 28px 16px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  margin-bottom: 10px;
}

.empty-text {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

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

/* File type icon */
.file-type-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  flex-shrink: 0;
}

/* Snippet form */
.snippet-form {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

/* Snippet preview */
.snippet-preview {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Modal / Dialog ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 12, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.modal-overlay.is-open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-dialog.modal-wide {
  max-width: 680px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 0;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.modal-close:hover {
  background: rgba(244, 63, 94, 0.1);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.3);
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-body > *:first-child {
  margin-top: 0;
}

.modal-body .upload-zone-inner {
  border-color: rgba(0, 229, 255, 0.2);
}

.modal-body .field-label {
  display: block;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-body input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.modal-body input[type="text"]:focus {
  outline: none;
  border-color: rgba(0, 229, 255, 0.46);
  box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.12);
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-dialog {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

@media (max-width: 1480px) {
  .acq-monitor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .acq-monitor-strategy-card {
    position: static;
  }
}

@media (max-width: 1280px) {
  .chat-layout.wechat-layout {
    grid-template-columns: minmax(260px, 1fr) minmax(0, 1.7fr);
  }

  .chat-layout.wechat-layout .chat-aside {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-message-body {
    max-width: min(82%, 620px);
  }

  .acq-monitor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .acq-monitor-strategy-card {
    position: static;
  }
}

@media (max-width: 1100px) {
  .topbar-content {
    max-width: none;
  }

  .chat-layout.wechat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-layout.wechat-layout .chat-aside {
    grid-template-columns: 1fr;
  }

  .chat-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chat-header-actions {
    min-width: 0;
    max-width: 100%;
    align-items: flex-start;
  }

  .chat-header-statuses {
    justify-content: flex-start;
  }

  .account-side-card {
    position: static;
  }
}

@media (max-width: 900px) {
  .page-customer {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    position: static;
    height: auto;
    max-height: none;
  }
  .sidebar.is-collapsed {
    width: 100%;
    min-width: 100%;
    padding: 0;
    height: 0;
    overflow: hidden;
  }
  .topbar {
    position: static;
  }
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .split-layout {
    grid-template-columns: 1fr;
  }
  .agent-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .agent-single-layout {
    grid-template-columns: 1fr;
  }
  .account-checkbox-grid {
    grid-template-columns: 1fr;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page > * {
    animation: none;
  }
}

/* Root WeChat Service Console V2 */
.root-console-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.root-download-card {
  margin-bottom: 16px;
  padding: 18px 20px;
}

.root-download-collapse {
  padding: 0;
  overflow: hidden;
}

.root-download-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.root-download-summary::-webkit-details-marker {
  display: none;
}

.root-download-summary:hover {
  background: rgba(59, 130, 246, 0.06);
}

.root-download-summary-copy {
  min-width: 0;
}

.root-download-chevron {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.34);
  color: var(--text-muted);
  display: grid;
  place-items: center;
}

.root-download-chevron::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.18s ease;
}

.root-download-collapse[open] .root-download-chevron::before {
  transform: translateY(2px) rotate(225deg);
}

.root-download-content {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding: 16px 20px 18px;
}

.root-download-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.root-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.root-download-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  align-items: center;
}

.root-download-main {
  min-width: 0;
}

.root-download-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.root-download-meta-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(5, 10, 20, 0.42);
  display: grid;
  gap: 6px;
}

.root-download-meta-item span {
  color: var(--text-muted);
  font-size: 11px;
}

.root-download-meta-item strong {
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.root-download-qr-shell {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.root-download-qr {
  width: 160px;
  height: 160px;
  border-radius: 20px;
  background: #f8fafc;
  padding: 10px;
  box-shadow: 0 16px 30px rgba(1, 5, 14, 0.32);
}

.root-download-qr-caption,
.root-download-qr-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
}

.root-panel {
  min-height: 0;
}

.root-device-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.root-device-card,
.root-account-card-v2,
.assistant-draft-card,
.assistant-chip-card,
.assistant-reference-card,
.root-account-row {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(8, 14, 28, 0.84);
  box-shadow: 0 18px 32px rgba(1, 5, 14, 0.34);
}

.root-device-card {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.root-device-card.is-online {
  border-color: rgba(34, 197, 94, 0.35);
}

.root-device-info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.root-device-info-item {
  color: var(--text-muted);
  font-size: 12px;
}

.root-device-top,
.root-account-card-top,
.root-conversation-topline,
.root-chat-header,
.root-chat-user,
.root-compose-actions,
.root-column-header,
.root-binding-form-header,
.root-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.root-device-name,
.root-account-card-title,
.root-account-row-title,
.root-chat-user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.root-device-meta,
.root-device-meta-line,
.root-account-card-meta,
.root-account-card-bottom,
.root-account-row-meta,
.root-chat-user-meta,
.root-conversation-meta,
.root-conversation-preview {
  color: var(--text-muted);
  font-size: 12px;
}

.root-device-statuses,
.root-chat-mode-badges,
.root-detail-grid,
.root-binding-actions,
.root-ops-grid,
.root-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.root-device-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.root-device-fact {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  gap: 8px;
}

.root-device-fact span {
  color: var(--text-muted);
  font-size: 11px;
}

.root-device-fact strong {
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.root-account-list {
  margin-bottom: 16px;
}

.root-account-row {
  padding: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.root-account-row:hover,
.root-account-card-v2:hover,
.assistant-draft-card:hover,
.assistant-chip-card:hover {
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.root-account-row.is-active,
.root-account-card-v2.is-active {
  border-color: rgba(0, 229, 255, 0.42);
  box-shadow: var(--glow);
}

.root-account-row-main {
  min-width: 0;
}

.root-account-row-side {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.root-binding-form-shell {
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.root-compact-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.root-form-field {
  display: grid;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.root-form-field label {
  min-width: 0;
}

.root-form-field input,
.root-form-field select {
  width: 100%;
}

.root-assignee-input {
  width: 100%;
}

.root-field-hint {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.root-advanced-panel {
  margin-top: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.root-advanced-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
}

.root-advanced-panel summary::-webkit-details-marker {
  display: none;
}

.root-advanced-panel[open] summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.root-compact-form-grid-advanced {
  padding: 14px;
}

.root-bind-code-hero {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(56, 189, 248, 0.12));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.root-bind-code-hero > div {
  min-width: 0;
}

.root-bind-code-hero.is-empty {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(5, 10, 20, 0.45);
}

.root-bind-code-value {
  margin-top: 6px;
  color: var(--text-strong);
  font-size: 30px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: 3px;
  font-family: "SFMono-Regular", "Consolas", monospace;
  overflow-wrap: anywhere;
}

.root-bind-code-meta {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.root-progress-shell {
  margin-top: 14px;
}

.root-progress-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(56, 189, 248, 0.08));
  display: grid;
  gap: 10px;
}

.root-progress-top,
.root-progress-meta,
.root-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.root-progress-title {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 700;
}

.root-progress-bar {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.root-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.25s ease;
}

.root-progress-meta {
  color: var(--text-strong);
  font-size: 13px;
}

.root-progress-meta span {
  flex: 1 1 260px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.root-progress-foot {
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.root-detail-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.root-detail-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(5, 10, 20, 0.5);
  display: grid;
  gap: 6px;
}

.root-action-bar {
  margin-top: 12px;
  align-items: center;
}

.root-action-bar form,
.root-action-bar a {
  margin: 0;
}

.root-test-panel {
  margin-top: 14px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(5, 10, 20, 0.46);
  display: grid;
  gap: 12px;
}

.root-test-panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.root-inline-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.root-summary-strip {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.root-summary-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(5, 10, 20, 0.42);
  display: grid;
  gap: 6px;
  min-width: 0;
}

.root-summary-item strong {
  color: var(--text-strong);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.root-inline-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.16);
  background: rgba(5, 10, 20, 0.32);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
}

.root-task-history {
  display: grid;
  gap: 10px;
}

.root-task-line {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(8, 14, 28, 0.62);
  display: grid;
  gap: 8px;
}

.root-task-line-top,
.root-task-line-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.root-task-line-top strong {
  color: var(--text-strong);
  font-size: 14px;
}

.root-task-line-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.root-task-line-message {
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.root-device-meta,
.root-device-meta-line,
.root-account-row-meta,
.root-progress-title {
  overflow-wrap: anywhere;
}

/* 渠道切换 Tab 条：微信 / 企微 */
.channel-tabs-strip {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  flex-wrap: wrap;
}

.channel-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  transition: all 0.2s ease;
  cursor: pointer;
}

.channel-tab-item:hover {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(0, 229, 255, 0.25);
  color: var(--text-strong);
}

.channel-tab-item.is-active {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--primary);
}

.channel-tab-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.channel-tab-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.channel-tab-label {
  flex: 1;
}

.channel-tab-count {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

.channel-tab-item.is-active .channel-tab-count {
  background: rgba(0, 229, 255, 0.2);
  color: #00e5ff;
}

.root-account-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.root-panel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.22);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.root-account-card-v2 {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.root-account-card-v2.is-empty {
  place-items: center;
  color: var(--text-muted);
  min-height: 120px;
}

.root-account-card-link {
  display: grid;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.root-account-ai-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.root-account-ai-switch form {
  display: inline-flex;
}

.root-mode-notice {
  color: var(--text-muted, #94a3b8);
  font-size: 12px;
  padding: 2px 8px;
  white-space: nowrap;
}

.root-account-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.root-workbench {
  display: grid;
  grid-template-columns: clamp(272px, 18vw, 320px) minmax(0, 2.25fr) clamp(292px, 20vw, 332px);
  gap: 16px;
  align-items: stretch;
}

.root-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
}

.root-column-list,
.root-column-assistant {
  overflow: hidden;
}

.root-column-list,
.root-column-chat,
.root-column-assistant {
  height: clamp(680px, calc(100vh - 168px), 900px);
  max-height: clamp(680px, calc(100vh - 168px), 900px);
}

.root-column-chat {
  overflow: hidden;
  padding: 14px 14px 12px;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(7, 13, 26, 0.96), rgba(4, 9, 20, 0.98));
}

.root-column-assistant {
  overflow: auto;
}

.root-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.root-search-form input {
  min-width: 0;
}

.root-conversation-list,
.root-message-stream {
  overflow: auto;
  min-height: 0;
}

.root-conversation-list {
  display: grid;
  flex: 1 1 auto;
  gap: 8px;
  align-content: start;
  grid-auto-rows: max-content;
}

.root-conversation-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 13px;
  min-height: 76px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background:
    linear-gradient(180deg, rgba(10, 18, 33, 0.84), rgba(6, 12, 24, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  cursor: pointer;
  align-self: start;
}

.root-conversation-item::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 3px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.root-conversation-item:hover,
.root-conversation-item.is-active {
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(7, 18, 35, 0.82);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(2, 8, 23, 0.24);
}

.root-conversation-item:hover::before,
.root-conversation-item.is-active::before {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.8), rgba(24, 184, 255, 0.28));
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.16);
}

.root-conversation-avatar {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(24, 184, 255, 0.32));
  color: var(--text-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.root-conversation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.root-conversation-avatar.large {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

.root-conversation-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
}

.root-conversation-preview,
.assistant-draft-content,
.assistant-reference-card span,
.assistant-chip-card span {
  line-height: 1.5;
}

.root-conversation-topline strong,
.root-conversation-preview {
  overflow-wrap: anywhere;
}

.root-conversation-topline {
  align-items: center;
}

.root-conversation-side {
  display: grid;
  justify-items: end;
  flex: 0 0 auto;
}

.root-conversation-name {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
  font-size: 15px;
  color: var(--text-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.root-conversation-time {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.root-conversation-preview {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 20px;
  font-size: 13px;
  color: rgba(203, 213, 225, 0.86);
}

.root-chat-header {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  margin-bottom: 12px;
  align-items: flex-start;
}

.root-chat-user {
  align-items: flex-start;
}

.root-chat-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
}

.root-chat-user-meta span {
  display: inline-flex;
  align-items: center;
}

.root-chat-user-meta span + span::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-right: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.38);
}

.root-chat-info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.root-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.root-chat-info-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(8, 14, 28, 0.78);
  min-width: 0;
}

.root-chat-info-card.is-official {
  border-color: rgba(34, 197, 94, 0.22);
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(14, 165, 233, 0.06)),
    rgba(8, 14, 28, 0.86);
}

.root-chat-info-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.root-chat-info-card strong {
  color: var(--text-strong);
  font-size: 14px;
  line-height: 1.4;
}

.root-chat-info-card span:last-child {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.root-message-stream {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px 28px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(8, 15, 28, 0.78), rgba(5, 10, 20, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.12);
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.root-chat-shell {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.root-msg {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.root-msg.is-agent {
  align-items: flex-end;
}

.root-msg.is-customer {
  align-items: flex-start;
}

.root-msg-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: min(84%, 820px);
  min-width: 0;
}

.root-msg.is-agent .root-msg-stack {
  margin-left: auto;
  align-items: flex-end;
}

.root-msg.is-customer .root-msg-stack {
  margin-right: auto;
  align-items: flex-start;
}

.root-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 100%;
  padding: 0 2px;
}

.root-msg-sender {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.64);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.root-msg-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.82;
}

.root-msg.is-agent .root-msg-meta {
  justify-content: flex-end;
}

.root-msg-bubble {
  display: block;
  width: fit-content;
  min-width: 0;
  max-width: min(100%, 820px);
  padding: 12px 16px;
  border-radius: 20px;
  text-align: left;
  box-sizing: border-box;
}

.root-msg-bubble.is-rich {
  width: min(100%, 680px);
  max-width: min(100%, 680px);
  padding: 14px 16px;
}

.root-msg.is-agent .root-msg-bubble {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(24, 184, 255, 0.3));
  border: 1px solid rgba(0, 229, 255, 0.24);
  box-shadow: 0 10px 24px rgba(0, 129, 167, 0.16);
}

.root-msg.is-customer .root-msg-bubble {
  background: rgba(248, 250, 252, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.root-msg-rich-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.4;
}

.root-msg-text {
  color: var(--text-strong);
  font-size: 14px;
  line-height: 1.76;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

.root-msg-rich-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

.root-msg-image-card,
.root-msg-quote-card {
  margin-top: 0;
}

.root-msg-image-card {
  display: flex;
  flex-direction: column;
}

.root-msg-image-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.root-msg-image-thumb {
  display: block;
  width: auto;
  max-width: min(320px, 100%);
  max-height: 280px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 12px 28px rgba(1, 8, 20, 0.24);
}

.root-msg-image-thumb.is-hidden,
.root-msg-image-placeholder.is-hidden {
  display: none !important;
}

.root-msg-image-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: min(220px, 100%);
  min-height: 96px;
  padding: 14px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 229, 255, 0.12)),
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.58));
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.root-msg-image-placeholder span {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.root-msg-image-placeholder small {
  color: var(--text-muted);
  font-size: 12px;
}

/* 媒体消息卡片样式 */
.root-msg-media-card {
  display: flex;
  flex-direction: column;
}

.root-msg-video {
  display: block;
  width: min(360px, 100%);
  max-height: 300px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.root-msg-video-cover {
  position: relative;
  width: min(280px, 72vw);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.root-msg-video-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.root-msg-video-cover.is-thumbnail-only .root-msg-video-thumb {
  opacity: 0.92;
}

.root-msg-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.32);
}

.root-msg-video-play::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 12px;
  border-left: 14px solid rgba(255, 255, 255, 0.94);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}

.root-msg-audio {
  width: min(320px, 100%);
  margin-top: 10px;
}

.media-preview-dialog {
  max-width: min(960px, calc(100vw - 32px));
}

.media-preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(68vh, 620px);
}

.media-preview-image,
.media-preview-video {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72vh;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.86);
}

.media-preview-video {
  width: min(880px, 100%);
}

.root-msg-media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 140px;
  min-height: 72px;
  padding: 16px 24px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(0, 229, 255, 0.1)),
    linear-gradient(180deg, rgba(15, 23, 42, 0.68), rgba(30, 41, 59, 0.52));
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.root-msg-media-placeholder span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.root-msg-media-placeholder small {
  color: var(--text-muted);
  font-size: 11px;
}

/* 语音转文字样式 */
.root-msg-voice-transcript {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.38);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.root-msg-voice-transcript .transcript-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.root-msg-voice-transcript .transcript-text {
  font-size: 14px;
  color: var(--text-strong);
  line-height: 1.5;
}

.root-msg-voice-transcript.is-muted .transcript-text {
  color: var(--text-muted);
}

.root-msg-voice-actions {
  margin-top: 12px;
}

.root-msg-voice-actions .btn-sm {
  font-size: 12px;
  padding: 4px 12px;
}

.media-fetch-btn.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.media-progress-ring {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  background: conic-gradient(rgba(0, 229, 255, 0.95) var(--media-progress, 0deg), rgba(148, 163, 184, 0.2) 0deg);
  position: relative;
}

.media-progress-ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.92);
}

.root-msg-quote-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.48);
  border-left: 3px solid rgba(0, 229, 255, 0.45);
}

.root-msg-quote-card strong {
  color: var(--text-strong);
  font-size: 12px;
}

.root-msg-quote-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.root-msg-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--primary);
  word-break: break-all;
}

.root-msg-link:hover {
  text-decoration: underline;
}

.root-compose-form {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(6, 12, 24, 0), rgba(6, 12, 24, 0.82) 22%, rgba(6, 12, 24, 0.98));
}

.root-compose-form textarea {
  min-height: 108px;
  resize: vertical;
}

.root-compose-actions {
  justify-content: flex-end;
  gap: 10px;
}

.root-compose-notice {
  flex: 1 1 260px;
  min-width: 0;
  color: var(--text-muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.assistant-panel-section + .assistant-panel-section {
  margin-top: 14px;
}

.assistant-panel-title {
  margin-bottom: 8px;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
}

/* 折叠面板样式 */
.assistant-collapsible {
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin-top: 14px;
}

.assistant-collapsible summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.assistant-collapsible summary::-webkit-details-marker {
  display: none;
}

.assistant-collapsible summary .assistant-panel-title {
  margin-bottom: 0;
}

.assistant-collapse-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
}

.assistant-collapsible[open] .assistant-collapse-hint {
  display: none;
}

.assistant-collapsible[open] summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.assistant-collapsible .assistant-card-stack {
  padding: 12px 14px;
}

.assistant-query-chip {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--text);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.assistant-draft-card,
.assistant-chip-card {
  cursor: pointer;
  width: 100%;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  text-align: left;
  color: inherit;
}

.assistant-draft-label {
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--primary);
  text-transform: uppercase;
}

.assistant-reference-card {
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  overflow-wrap: anywhere;
}

.root-assets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1280px) {
  .root-workbench {
    grid-template-columns: minmax(280px, 316px) minmax(0, 1fr);
  }

  .root-column-assistant {
    grid-column: 1 / -1;
  }

  .root-chat-info-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .root-console-grid,
  .root-assets-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .root-workbench {
    grid-template-columns: 1fr;
  }

  .root-mode-switch,
  .root-download-card-top,
  .root-chat-header,
  .root-chat-user,
  .root-compose-actions,
  .root-device-top,
  .root-account-row {
    align-items: stretch;
    flex-direction: column;
  }

  .root-search-form {
    grid-template-columns: 1fr;
  }

  .root-chat-info-strip {
    grid-template-columns: 1fr;
  }

  .root-conversation-item {
    min-height: 74px;
  }

  .root-msg-stack {
    max-width: 100%;
  }

  .root-bind-code-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .root-download-grid,
  .root-device-facts,
  .root-compact-form-grid {
    grid-template-columns: 1fr;
  }
}
