:root {
  --bg-page: #faf9f6;
  --bg-sidebar: #f7f4ee;
  --bg-card: #ffffff;
  --bg-card-soft: #fcfbf8;
  --bg-muted: #f3f0ea;
  --brand-gold: #b88a45;
  --brand-gold-soft: #d8b77a;
  --brand-gold-light: #f3e7d1;
  --brand-gold-bg: #f8f0e2;
  --text-primary: #1f1d1a;
  --text-secondary: #6f6a61;
  --text-muted: #9a948a;
  --text-faint: #c6bfb3;
  --border-light: #e9e3d8;
  --border-medium: #ded5c8;
  --success: #4f9d69;
  --success-bg: #eaf6ee;
  --warning: #c9912b;
  --warning-bg: #fff5df;
  --danger: #c75c5c;
  --danger-bg: #fceaea;
  --info: #5a7fa8;
  --info-bg: #eef4fa;
  --shadow-soft: 0 10px 30px rgba(60, 45, 25, 0.06);
  --shadow-card: 0 12px 40px rgba(60, 45, 25, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 1180px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(214, 180, 122, 0.08), transparent 30%),
    linear-gradient(180deg, #faf9f6 0%, #f7f4ee 100%);
  color: var(--text-primary);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

body[data-admin-auth="checking"] .app-shell,
body[data-admin-auth="checking"] .detail-drawer,
body[data-admin-auth="login"] .app-shell,
body[data-admin-auth="login"] .detail-drawer {
  display: none;
}

body[data-admin-auth="authenticated"] .admin-login-screen {
  display: none;
}

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

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(680px, 1fr) 380px;
  min-height: 100vh;
}

.admin-login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.admin-login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-card);
}

.admin-login-brand {
  padding: 0 0 8px;
}

.admin-login-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
}

.admin-login-heading p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.compact-action {
  height: 38px;
  padding: 0 14px;
}

body[data-route="users"] .app-shell,
body[data-route="userDetail"] .app-shell,
body[data-route="groups"] .app-shell,
body[data-route="groupDetail"] .app-shell,
body[data-route="chatrooms"] .app-shell,
body[data-route="groupSessions"] .app-shell,
body[data-route="privateSessions"] .app-shell,
body[data-route="relationships"] .app-shell,
body[data-route="import"] .app-shell,
body[data-route="sessions"] .app-shell,
body[data-route="agents"] .app-shell,
body[data-route="agentDetail"] .app-shell {
  grid-template-columns: 240px minmax(820px, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px;
  background: rgba(247, 244, 238, 0.95);
  border-right: 1px solid var(--border-light);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(184, 138, 69, 0.32);
  border-radius: 12px;
  background: linear-gradient(145deg, #fffaf0, #f4dfba);
  color: #8a622a;
  font-weight: 700;
}

.brand-title {
  font-size: 15px;
  font-weight: 650;
}

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

.nav-section {
  display: grid;
  gap: 14px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group-title {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.nav-sublist {
  display: grid;
  gap: 6px;
  margin-left: 14px;
  padding-left: 12px;
  border-left: 1px solid var(--border-light);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.56);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--brand-gold-light);
  border-color: rgba(184, 138, 69, 0.22);
  color: #8a622a;
}

.nav-item-parent {
  font-weight: 650;
}

.nav-item-child {
  height: 40px;
  padding-left: 10px;
  font-size: 13px;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.storage-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow-soft);
}

.storage-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.storage-meta {
  margin: 10px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.main {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 320px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  background: #fff;
  color: var(--text-muted);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: transparent;
  font-size: 13px;
}

kbd {
  padding: 2px 6px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-card-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
}

.avatar-block {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 4px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--brand-gold-bg);
  color: #8a622a;
  font-weight: 700;
}

.avatar-name {
  font-size: 13px;
  font-weight: 650;
}

.avatar-role {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 11px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card,
.card,
.detail-drawer {
  border: 1px solid rgba(226, 218, 205, 0.9);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 40px rgba(60, 45, 25, 0.06);
}

.metric-card,
.card {
  border-radius: 16px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.metric-card:hover,
.card:hover {
  border-color: rgba(184, 138, 69, 0.32);
  box-shadow: 0 16px 48px rgba(60, 45, 25, 0.09);
  transform: translateY(-1px);
}

.metric-card {
  min-width: 0;
  padding: 18px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--brand-gold-bg);
  color: var(--brand-gold);
}

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

.metric-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 8px;
}

.metric-value {
  color: var(--text-primary);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.metric-unit {
  color: var(--text-muted);
  font-size: 13px;
}

.metric-sub {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-bottom: 20px;
}

.graph-card {
  min-height: 500px;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.card {
  padding: 20px;
}

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

.section-header h2 {
  margin: 0;
  color: #2a2722;
  font-size: 16px;
  font-weight: 650;
}

.section-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.info {
  background: var(--info-bg);
  color: var(--info);
}

.graph-stage {
  height: 430px;
  overflow: hidden;
  border: 1px solid rgba(226, 218, 205, 0.66);
  border-radius: 14px;
  background:
    radial-gradient(circle at 22% 18%, rgba(90, 127, 168, 0.12), transparent 26%),
    radial-gradient(circle at 80% 72%, rgba(79, 157, 105, 0.1), transparent 28%),
    linear-gradient(rgba(90, 127, 168, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 127, 168, 0.06) 1px, transparent 1px),
    #fffdf9;
  background-size: auto, auto, 34px 34px, 34px 34px;
  touch-action: none;
}

#relationshipGraph,
#relationshipDetailGraph {
  width: 100%;
  height: 100%;
}

.relationship-detail-graph-stage {
  height: 460px;
}

.detail-graph-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.compact-header {
  margin-bottom: 12px;
}

.graph-empty {
  fill: var(--text-muted);
  font-size: 13px;
}

.memory-graph-link {
  stroke: rgba(111, 106, 97, 0.26);
  stroke-width: 1.2;
  transition: opacity 0.2s ease, stroke 0.2s ease, stroke-width 0.2s ease;
}

.memory-graph-link.link-field {
  stroke: rgba(90, 127, 168, 0.22);
  stroke-dasharray: 4 5;
}

.memory-graph-link.link-relationship {
  stroke: rgba(184, 138, 69, 0.34);
}

.memory-graph-link.selected {
  stroke: rgba(31, 29, 26, 0.55);
  stroke-width: 1.8;
}

.memory-graph-link.dimmed {
  opacity: 0.16;
}

.memory-graph-node {
  cursor: grab;
  outline: none;
  transition: opacity 0.2s ease;
}

.memory-graph-node.dragging {
  cursor: grabbing;
}

.memory-graph-node.dimmed {
  opacity: 0.24;
}

.memory-graph-node .node-halo {
  fill: rgba(90, 127, 168, 0.08);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.memory-graph-node:hover .node-halo,
.memory-graph-node.selected .node-halo {
  opacity: 1;
}

.memory-graph-node .node-core {
  fill: rgba(255, 255, 255, 0.96);
  stroke: rgba(90, 127, 168, 0.36);
  stroke-width: 1.25;
  filter: drop-shadow(0 10px 18px rgba(31, 29, 26, 0.11));
}

.memory-graph-node.node-user .node-core {
  stroke: rgba(90, 127, 168, 0.58);
}

.memory-graph-node.node-relationship .node-core {
  stroke: rgba(184, 138, 69, 0.58);
  fill: #fffaf1;
}

.memory-graph-node.node-user-field .node-core {
  fill: #f7fbff;
  stroke: rgba(90, 127, 168, 0.28);
}

.memory-graph-node.node-relationship-field .node-core {
  fill: #f7fcf8;
  stroke: rgba(79, 157, 105, 0.3);
}

.memory-graph-node.selected .node-core {
  stroke: rgba(31, 29, 26, 0.62);
  stroke-width: 1.8;
}

.memory-graph-node text {
  pointer-events: none;
}

.memory-graph-node .node-title {
  fill: var(--text-primary);
  font-size: 12px;
  font-weight: 450;
}

.memory-graph-node .node-subtitle {
  fill: var(--text-muted);
  font-size: 9px;
  font-weight: 400;
}

.memory-graph-node.node-user-field .node-title,
.memory-graph-node.node-relationship-field .node-title {
  font-size: 10px;
}

.memory-graph-node.node-user-field .node-subtitle,
.memory-graph-node.node-relationship-field .node-subtitle {
  display: none;
}

.list-panel {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.memory-row {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid rgba(226, 218, 205, 0.8);
  border-radius: 12px;
  background: rgba(252, 251, 248, 0.74);
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease;
}

button.memory-row {
  width: 100%;
}

.memory-row:hover,
.memory-row.selected {
  border-color: rgba(184, 138, 69, 0.35);
  background: #fffaf1;
}

.memory-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 650;
}

.memory-row-content {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.memory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-tag {
  padding: 3px 7px;
  border: 1px solid rgba(222, 213, 200, 0.9);
  border-radius: 999px;
  color: var(--text-muted);
  background: #fff;
  font-size: 11px;
}

.segmented-control {
  display: flex;
  width: fit-content;
  padding: 3px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-muted);
}

.segment {
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
}

.segment.active {
  background: #fff;
  color: #8a622a;
  box-shadow: 0 4px 14px rgba(60, 45, 25, 0.06);
}

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

.form-grid.single {
  margin-top: 0;
}

.form-grid.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--text-primary);
  font-size: 13px;
}

input {
  height: 38px;
  padding: 0 11px;
}

select {
  height: 38px;
  padding: 0 34px 0 11px;
}

textarea {
  min-height: 128px;
  resize: vertical;
  padding: 11px;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(184, 138, 69, 0.55);
  box-shadow: 0 0 0 3px rgba(184, 138, 69, 0.12);
}

.full-field {
  margin-top: 12px;
}

.actions-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.left-actions {
  justify-content: flex-start;
}

.switch-label {
  display: flex;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
}

.switch-label input {
  width: 16px;
  height: 16px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 650;
}

.primary-button {
  border: 1px solid rgba(138, 98, 42, 0.25);
  background: var(--brand-gold);
  color: #fff;
}

.primary-button:hover {
  background: #a77838;
}

.secondary-button {
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-secondary);
}

.secondary-button:hover {
  border-color: rgba(184, 138, 69, 0.34);
  background: #fffaf1;
  color: var(--text-primary);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-secondary);
}

.icon-button:hover {
  border-color: rgba(184, 138, 69, 0.34);
  color: var(--brand-gold);
}

.button-icon {
  display: grid;
  place-items: center;
}

.result-box {
  min-height: 112px;
  max-height: 220px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid rgba(226, 218, 205, 0.8);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.result-box a {
  color: var(--brand-gold);
  font-weight: 650;
  text-decoration: none;
}

.result-box a:hover {
  text-decoration: underline;
}

.wechat-binding-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.85);
  border-radius: 12px;
  background: #fffdf9;
}

.section-header.compact {
  margin-bottom: 0;
}

.section-header.compact h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.section-header.compact p {
  margin: 0;
}

.wechat-process-list {
  display: grid;
  gap: 8px;
}

.wechat-process-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: #fff;
}

.wechat-process-item.active {
  border-color: rgba(184, 138, 69, 0.45);
  background: #fffaf1;
}

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

.wechat-process-title span {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

.wechat-process-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

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

.detail-drawer {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
  border-width: 0 0 0 1px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

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

.drawer-header p {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.drawer-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0;
}

.detail-section {
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
}

.detail-id {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
  word-break: break-all;
}

.detail-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.confidence-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.confidence-row strong {
  font-size: 28px;
  font-weight: 500;
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe8dd;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-gold-soft);
  transition: width 0.28s ease;
}

.stars {
  color: #c8a96a;
  font-size: 20px;
  letter-spacing: 0;
}

.detail-content {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.detail-content p {
  margin: 0 0 12px;
}

.drawer-field-list {
  display: grid;
  gap: 9px;
}

.drawer-field-row {
  padding: 10px;
  border: 1px solid rgba(226, 218, 205, 0.72);
  border-radius: 10px;
  background: #fff;
}

.drawer-field-label,
.drawer-field-meta span {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.drawer-field-value {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-secondary);
}

.drawer-value-chip {
  max-width: 100%;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.drawer-kv {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
}

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

.drawer-kv strong,
.drawer-field-meta strong {
  color: var(--text-secondary);
  font-weight: 450;
}

.drawer-field-meta {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

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

.entity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed var(--border-medium);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.compact-empty {
  min-height: 96px;
}

.wide-button {
  width: 100%;
  margin-top: 14px;
}

.page-panel {
  min-height: calc(100vh - 128px);
  padding: 24px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 40px rgba(60, 45, 25, 0.06);
}

.page-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.import-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.import-timer {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  min-width: 36px;
}

.page-panel-header h2 {
  margin: 8px 0 0;
  color: var(--text-primary);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: 0;
}

.page-panel-header p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.back-link {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-gold);
  font-size: 13px;
  font-weight: 650;
}

.back-link::before {
  content: "←";
  margin-right: 6px;
}

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

.user-directory,
.relationship-directory,
.agent-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.registered-users-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 12px;
  background: #fffdf9;
}

.registered-user-list {
  display: grid;
  gap: 10px;
}

.registered-user-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(180px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(226, 218, 205, 0.78);
  border-radius: 10px;
  background: #fff;
}

.registered-user-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-gold-bg);
  color: #8a622a;
  font-weight: 760;
  overflow: hidden;
}

.registered-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.registered-user-main,
.registered-user-times {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.registered-user-name {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 750;
}

.registered-user-meta,
.registered-user-times {
  color: var(--text-muted);
  font-size: 12px;
}

.registered-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.directory-card {
  display: grid;
  gap: 14px;
  width: 100%;
  min-height: 154px;
  padding: 18px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: #fffdf9;
  text-align: left;
  box-shadow: 0 8px 28px rgba(60, 45, 25, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.directory-card:hover {
  border-color: rgba(184, 138, 69, 0.36);
  background: #fffaf1;
  transform: translateY(-1px);
}

.directory-card-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: flex-start;
}

.directory-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(184, 138, 69, 0.28);
  border-radius: 14px;
  background: var(--brand-gold-bg);
  color: #8a622a;
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
}

.directory-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.directory-card h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 650;
}

.directory-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.detail-page {
  padding: 24px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.1fr);
  gap: 18px;
}

.import-workbench,
.preview-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: #fffdf9;
}

.import-textarea {
  min-height: 320px;
}

.preview-content {
  display: grid;
  gap: 16px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.batch-list,
.session-list {
  display: grid;
  gap: 10px;
}

.batch-progress-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 14px;
  background: #fff;
}

.batch-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.batch-progress-head strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}

.batch-progress-head span {
  color: var(--brand-gold);
  font-size: 12px;
  font-weight: 700;
}

.batch-progress-bar {
  height: 8px;
}

.batch-progress-current {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.selected-session-summary {
  display: grid;
  gap: 12px;
}

.sessions-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
}

.sessions-directory-panel,
.sessions-detail-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: #fffdf9;
}

.sessions-detail-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.session-directory-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.session-row {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 24px rgba(60, 45, 25, 0.04);
}

.session-row[role="button"] {
  cursor: pointer;
}

.session-row:hover {
  border-color: rgba(184, 138, 69, 0.34);
}

.session-row:focus-visible {
  outline: 2px solid rgba(184, 138, 69, 0.5);
  outline-offset: 2px;
}

.session-row.active,
.session-row.running {
  border-color: rgba(184, 138, 69, 0.56);
  background: #fffaf1;
  box-shadow: 0 10px 30px rgba(60, 45, 25, 0.08);
}

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

.session-row-head strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.session-row-sub {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.session-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--text-muted);
  font-size: 11px;
}

.session-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.session-row-actions .secondary-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.session-summary-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 14px;
  background: #fff;
}

.session-summary-raw {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(226, 218, 205, 0.8);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.managed-session-raw {
  max-height: 420px;
  overflow: auto;
}

.session-detail-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-muted);
}

.session-detail-tab {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.session-detail-tab.active {
  background: #fff;
  color: #8a622a;
  box-shadow: 0 4px 14px rgba(60, 45, 25, 0.06);
}

.live-message-list {
  display: grid;
  gap: 10px;
}

.live-message-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 12px;
  background: #fff;
}

.live-message-item.agent-message {
  border-color: rgba(90, 127, 168, 0.24);
  background: var(--info-bg);
}

.live-message-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.live-message-sender {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

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

.live-message-body {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.chatroom-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 132px);
  min-height: 620px;
}

.chatroom-sidebar,
.chatroom-panel {
  min-width: 0;
  min-height: 0;
  padding: 18px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: #fffdf9;
}

.chatroom-list {
  display: grid;
  gap: 10px;
}

.chatroom-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  align-content: stretch;
  padding: 0;
  overflow: hidden;
}

.wechat-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(226, 218, 205, 0.86);
  background: #fff;
}

.wechat-room-header h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.wechat-room-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.wechat-room-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatroom-feed-switch {
  min-height: 38px;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 10px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.chatroom-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: #f1f1f1;
  overscroll-behavior: contain;
}

.chatroom-composer {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 0;
  background: #fff;
}

.wechat-composer-meta {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px 160px;
  gap: 10px;
}

.wechat-composer-meta label span {
  font-size: 11px;
}

.chat-agent-chip-row,
.wechat-agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chatroom-agent-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto;
  gap: 8px;
  align-items: center;
}

.chatroom-agent-add-row select {
  min-height: 34px;
}

.chatroom-auto-panel {
  display: grid;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(90, 127, 168, 0.14);
  border-radius: 8px;
  background: #f8fbff;
}

.chatroom-event-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.chatroom-event-fields label {
  display: grid;
  gap: 4px;
}

.chatroom-event-fields label span {
  color: var(--text-muted);
  font-size: 11px;
}

.chatroom-event-fields textarea {
  min-height: 54px;
  max-height: 120px;
  border-radius: 8px;
  background: #fff;
}

.chatroom-event-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
  min-height: 54px;
}

.chatroom-auto-fields {
  display: grid;
  grid-template-columns: 116px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.chatroom-auto-fields label {
  display: grid;
  gap: 4px;
}

.chatroom-auto-fields label span {
  color: var(--text-muted);
  font-size: 11px;
}

.chatroom-auto-fields input {
  min-height: 34px;
}

.chatroom-auto-starter {
  min-width: 0;
}

.chatroom-auto-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.chatroom-export-result {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(90, 127, 168, 0.18);
  border-radius: 8px;
  background: var(--info-bg);
  color: var(--text-secondary);
  font-size: 12px;
}

.chatroom-export-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chatroom-export-result a {
  color: var(--info);
  font-weight: 700;
  text-decoration: none;
}

.chatroom-export-video {
  width: 160px;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(90, 127, 168, 0.18);
  border-radius: 8px;
  background: #111;
}

.chatroom-export-image {
  width: 160px;
  max-width: 100%;
  max-height: 260px;
  border: 1px solid rgba(90, 127, 168, 0.18);
  border-radius: 8px;
  background: #f1f1f1;
  object-fit: contain;
  object-position: top center;
}

.chat-agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  min-height: 34px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.chat-agent-chip:has(input:checked) {
  border-color: rgba(79, 157, 105, 0.35);
  background: var(--success-bg);
  color: var(--text-primary);
}

.chat-agent-chip input {
  width: 14px;
  margin: 0 0 0 4px;
}

.chat-agent-chip-avatar,
.chat-agent-speak-button img {
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  max-width: 24px;
  min-height: 24px;
  max-height: 24px;
  border-radius: 50%;
  background: var(--brand-gold-light);
  color: #8a622a;
  font-size: 11px;
  font-weight: 750;
  overflow: hidden;
}

.chat-agent-chip-avatar img,
.chat-agent-speak-button img,
.wechat-avatar img,
.agent-avatar-preview img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover;
}

.chat-agent-speak-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
}

.wechat-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.wechat-input-row textarea {
  min-height: 42px;
  max-height: 110px;
  resize: vertical;
  border-radius: 8px;
  background: #f7f7f7;
}

.wechat-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 68%);
  align-items: start;
  gap: 10px;
}

.wechat-message.mine {
  grid-template-columns: minmax(0, 68%) 38px;
  justify-content: end;
}

.wechat-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: #d9e8d6;
  color: #3f7d57;
  font-size: 14px;
  font-weight: 750;
  overflow: hidden;
}

.wechat-avatar.mine-avatar {
  background: #d8e7f5;
  color: var(--info);
}

.wechat-message-main {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.wechat-message.mine .wechat-message-main {
  justify-items: end;
}

.wechat-message-name,
.wechat-message-time {
  color: var(--text-muted);
  font-size: 11px;
}

.wechat-bubble {
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 5px;
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.wechat-message.mine .wechat-bubble {
  background: #95ec69;
}

.wechat-message.agent .wechat-bubble {
  background: #fff;
}

.wechat-event-message {
  justify-self: center;
  display: grid;
  gap: 5px;
  width: min(560px, 100%);
  padding: 10px 12px;
  border: 1px solid rgba(67, 122, 91, 0.18);
  border-radius: 8px;
  background: #eff7f2;
  color: #31563d;
}

.wechat-event-label,
.wechat-event-time {
  color: rgba(49, 86, 61, 0.72);
  font-size: 11px;
  font-weight: 760;
}

.wechat-event-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.58;
  font-size: 13px;
}

.wechat-text {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.wechat-voice-bubble {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 120px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: rgba(149, 236, 105, 0.32);
  color: #315f21;
  font-size: 13px;
}

.voice-wave {
  font-weight: 800;
  transform: rotate(180deg);
}

.agent-avatar-panel,
.agent-voice-preview-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 14px;
  background: #fffdf9;
}

.agent-avatar-panel .section-header,
.agent-voice-preview-panel .section-header {
  align-items: center;
}

.agent-avatar-preview {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--brand-gold-light);
  color: #8a622a;
  font-size: 20px;
  font-weight: 800;
  overflow: hidden;
}

.agent-avatar-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px dashed rgba(184, 138, 69, 0.34);
  border-radius: 12px;
  background: #fff;
}

.agent-avatar-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.agent-avatar-upload span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-voice-preview-panel textarea {
  min-height: 64px;
  resize: vertical;
  border-radius: 10px;
  background: #fff;
}

.voice-emotion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.voice-emotion-control {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(226, 218, 205, 0.85);
  border-radius: 10px;
  background: #fff;
}

.voice-emotion-control span {
  color: var(--text-secondary);
  font-size: 12px;
}

.voice-emotion-control strong {
  color: var(--text-primary);
  font-size: 12px;
  text-align: right;
}

.voice-emotion-control input {
  width: 100%;
}

.agent-voice-player {
  width: 100%;
  min-height: 36px;
}

.batch-card,
.session-card {
  width: 100%;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 24px rgba(60, 45, 25, 0.04);
}

button.batch-card {
  padding: 14px;
}

.batch-card:hover,
.session-card:hover {
  border-color: rgba(184, 138, 69, 0.34);
}

.batch-card.active,
.session-card.active {
  border-color: rgba(184, 138, 69, 0.56);
  background: #fffaf1;
  box-shadow: 0 10px 30px rgba(60, 45, 25, 0.08);
}

.session-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.session-card.running {
  border-color: rgba(201, 145, 43, 0.45);
  background: #fffaf1;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.session-live {
  color: var(--warning);
  font-weight: 700;
}

.session-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.session-actions .secondary-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

#sessionManagerDetail .preview-section {
  gap: 8px;
}

#sessionManagerDetail .preview-section h3 {
  font-size: 13px;
}

#sessionManagerDetail .session-summary-card {
  gap: 8px;
  padding: 12px;
}

#sessionManagerDetail .session-meta {
  gap: 8px 12px;
  font-size: 11px;
}

#sessionManagerDetail .actions-row {
  margin-top: 8px;
}

#sessionManagerDetail .session-raw pre,
#sessionManagerDetail .session-summary-raw {
  font-size: 11px;
  line-height: 1.55;
}

.session-error {
  padding: 10px 12px;
  border: 1px solid rgba(199, 92, 92, 0.18);
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
}

.session-raw {
  border-top: 1px solid rgba(226, 218, 205, 0.72);
  padding-top: 10px;
}

.session-raw summary {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.session-raw pre {
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid rgba(226, 218, 205, 0.8);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.session-manager-analysis {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.llm-log-box {
  min-height: 480px;
  max-height: 640px;
  margin: 14px 0 0;
}

.preview-section {
  display: grid;
  gap: 10px;
}

.preview-section h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 650;
}

.collapsible-section {
  border: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.collapsible-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 650;
}

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

.collapsible-summary::after {
  content: "展开";
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.collapsible-section[open] .collapsible-summary::after {
  content: "收起";
}

.collapsible-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.preview-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 14px;
  background: #fff;
}

.preview-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.7;
}

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

.advice-editor {
  min-height: 220px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

.compact-advice-editor {
  min-height: 260px;
}

.advice-suggestion-card {
  gap: 12px;
}

.advice-suggestion-editor {
  min-height: 120px;
}

.structured-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: #fff;
}

.structured-card-compact {
  padding: 14px;
}

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

.structured-card-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 650;
}

.structured-card-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  word-break: break-all;
}

.structured-field {
  display: grid;
  gap: 10px;
}

.structured-field-title {
  color: var(--brand-gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.structured-text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.75;
}

.structured-list,
.structured-event-list,
.structured-stack {
  display: grid;
  gap: 10px;
}

.structured-list {
  margin: 0;
  padding-left: 18px;
}

.structured-list-item {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.structured-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.structured-event-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 12px;
  background: #fffdf9;
}

.structured-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.structured-event-index {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 650;
}

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

.structured-event-body {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.structured-kv {
  display: grid;
  gap: 8px;
}

.structured-kv-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 218, 205, 0.72);
  border-radius: 12px;
  background: #fffdf9;
}

.structured-kv-row span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.structured-kv-row strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.structured-empty {
  padding: 12px;
  border: 1px dashed var(--border-medium);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.preview-list {
  display: grid;
  gap: 7px;
}

.preview-list div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.preview-list strong {
  color: var(--brand-gold);
  font-weight: 650;
}

.tall-result {
  max-height: 360px;
}

.diff-added {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  color: #166534;
  background: #f0fdf4;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12px;
  line-height: 1.5;
}

.diff-added strong {
  color: #15803d;
  font-weight: 650;
}

.diff-removed {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  color: #9f1239;
  background: #fff1f2;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.75;
}

.diff-removed strong {
  color: #be123c;
  font-weight: 650;
}

.diff-kept {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  color: var(--text-tertiary, #9e9589);
  font-size: 12px;
  line-height: 1.5;
}

.diff-kept strong {
  color: var(--text-tertiary, #9e9589);
  font-weight: 650;
}

.diff-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.diff-badge-new {
  background: #dcfce7;
  color: #15803d;
}

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

body[data-route="relationshipDetail"] .detail-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

.detail-summary,
.editor-panel {
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 16px;
  background: #fffdf9;
}

.detail-summary {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
}

.summary-block {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.summary-block h3 {
  margin: 14px 0 8px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 650;
}

.summary-block p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.summary-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(226, 218, 205, 0.72);
  border-radius: 12px;
  background: #fff;
}

.summary-metric span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.summary-metric strong {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 550;
}

.editor-panel {
  padding: 16px;
}

.json-editor {
  min-height: calc(100vh - 270px);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}

.markdown-editor {
  min-height: 260px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

body[data-route="users"] .detail-drawer,
body[data-route="userDetail"] .detail-drawer,
body[data-route="groups"] .detail-drawer,
body[data-route="groupDetail"] .detail-drawer,
body[data-route="chatrooms"] .detail-drawer,
body[data-route="groupSessions"] .detail-drawer,
body[data-route="privateSessions"] .detail-drawer,
body[data-route="relationships"] .detail-drawer,
body[data-route="import"] .detail-drawer,
body[data-route="sessions"] .detail-drawer,
body[data-route="agents"] .detail-drawer,
body[data-route="agentDetail"] .detail-drawer {
  display: none;
}

.link-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-list {
  display: grid;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid rgba(226, 218, 205, 0.9);
  border-radius: 12px;
  background: #fff8ef;
}

.checkbox-item input {
  margin: 0;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(222, 213, 200, 0.9);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

button.link-chip:hover {
  border-color: rgba(184, 138, 69, 0.34);
  background: #fffaf1;
  color: var(--text-primary);
}

.modal {
  width: min(520px, calc(100vw - 48px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
}

.chatroom-create-modal {
  width: min(920px, calc(100vw - 56px));
}

.modal::backdrop {
  background: rgba(31, 29, 26, 0.22);
  backdrop-filter: blur(6px);
}

.modal-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(226, 218, 205, 0.96);
  border-radius: 18px;
  background: #fffdf9;
  box-shadow: 0 20px 70px rgba(60, 45, 25, 0.16);
}

.chatroom-create-modal .modal-card {
  gap: 16px;
}

.chatroom-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chatroom-picker-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(226, 218, 205, 0.92);
  border-radius: 14px;
  background: #fff;
}

.chatroom-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chatroom-picker-head h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.chatroom-picker-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.chatroom-picker-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.chatroom-picker-item {
  display: grid;
  grid-template-columns: 18px 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px;
  border: 1px solid rgba(226, 218, 205, 0.86);
  border-radius: 12px;
  background: #fffdf9;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.chatroom-picker-item:hover {
  border-color: rgba(184, 138, 69, 0.36);
  box-shadow: 0 8px 24px rgba(60, 45, 25, 0.05);
}

.chatroom-picker-item:has(input:checked) {
  border-color: rgba(90, 127, 168, 0.38);
  background: var(--info-bg);
}

.chatroom-picker-item input {
  margin: 0;
}

.chatroom-picker-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-gold-light);
  color: #8a622a;
  font-size: 12px;
  font-weight: 750;
}

.chatroom-picker-avatar.user-avatar {
  background: var(--success-bg);
  color: var(--success);
}

.chatroom-picker-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.chatroom-picker-copy strong,
.chatroom-picker-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chatroom-picker-copy strong {
  color: var(--text-primary);
  font-size: 13px;
}

.chatroom-picker-copy span {
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: 220px minmax(680px, 1fr);
  }

  body:not([data-route="hub"]):not([data-route="relationshipDetail"]) .detail-drawer {
    display: none;
  }

  .import-layout,
  .sessions-layout {
    grid-template-columns: 1fr;
  }
}
