:root {
  --bg: #070a12;
  --panel: #0e1422;
  --panel-2: #131b2d;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e8edf7;
  --muted: #97a3b8;
  --accent: #6d7cff;
  --accent-strong: #5b6bff;
  --cyan: #35d6e8;
  --ok: #3ddc97;
  --warn: #fbbf6b;
  --danger: #ff6b81;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(109, 124, 255, 0.18), transparent 62%),
    radial-gradient(760px 460px at 105% -6%, rgba(53, 214, 232, 0.1), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.hint {
  margin-top: 10px;
  color: #7c889d;
  font-size: 12px;
  line-height: 1.65;
}

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* ---------- 启动加载 ---------- */

.boot-loading {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(109, 124, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 登录视图 ---------- */

.auth-view {
  min-height: 100dvh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 34px 18px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand {
  text-align: center;
}

.brand-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  font-size: 25px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #8b5cf6 45%, var(--cyan));
  box-shadow: 0 14px 34px rgba(109, 124, 255, 0.35);
}

.brand h1 {
  font-size: 25px;
  letter-spacing: 0.02em;
}

.brand p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
}

.auth-card {
  padding: 20px;
}

.auth-foot {
  text-align: center;
  color: #5f6b80;
  font-size: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 6px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.tab.is-active {
  background: rgba(109, 124, 255, 0.16);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(109, 124, 255, 0.36);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

/* ---------- 表单 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  background: rgba(5, 8, 16, 0.65);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 11px;
  padding: 12px 13px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: rgba(109, 124, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.16);
}

input::placeholder,
textarea::placeholder {
  color: #5c687d;
}

.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 129, 0.1);
  border: 1px solid rgba(255, 107, 129, 0.32);
  color: #ffb3bf;
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- 按钮 ---------- */

.btn {
  border: 0;
  border-radius: 11px;
  padding: 12px 18px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.primary {
  background: linear-gradient(135deg, #6d7cff, #5b6bff 62%, #4f5df0);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(91, 107, 255, 0.3);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn.primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn.small {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn.block {
  width: 100%;
  padding: 13px;
}

/* ---------- 房间视图 ---------- */

.room-view {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 6px 4px 2px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.ident-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}

#room-id-display {
  font-size: 30px;
  letter-spacing: 0.07em;
  font-variant-numeric: tabular-nums;
}

.mini-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.mini-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.conn-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
}

.conn-badge[data-state="online"] {
  color: #9ff0c8;
  border-color: rgba(61, 220, 151, 0.3);
  background: rgba(61, 220, 151, 0.08);
}

.conn-badge[data-state="online"] i {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(61, 220, 151, 0.8);
}

.conn-badge[data-state="reconnecting"] i {
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: 0.25; }
}

.room-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.room-head-text {
  min-width: 0;
}

.room-head h2 {
  font-size: 19px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-head .muted {
  margin-top: 5px;
  font-size: 12.5px;
}

.online-stat {
  flex: 0 0 auto;
  text-align: right;
  padding: 2px 2px 0;
}

.online-stat strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #c3caff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.online-stat span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
}

.duration-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.duration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.duration-head label {
  font-size: 14px;
}

.duration-input {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.duration-input input {
  width: 74px;
  padding: 8px 10px;
  text-align: center;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(109, 124, 255, 0.95), rgba(53, 214, 232, 0.7));
  box-shadow: none;
  cursor: pointer;
}

input[type="range"]:focus {
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #5b6bff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #5b6bff;
}

.duration-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #5f6b80;
  font-size: 11px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h3 {
  font-size: 15.5px;
}

.section-head .muted {
  font-size: 12px;
  text-align: right;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.chip.is-active {
  background: rgba(109, 124, 255, 0.18);
  border-color: rgba(109, 124, 255, 0.55);
  color: #ccd3ff;
}

.send-card textarea {
  min-height: 96px;
}

.send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
}

.counter {
  color: #5f6b80;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#send-btn {
  min-width: 128px;
}

.anchor-list,
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anchor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.anchor-item:hover {
  border-color: var(--line-strong);
}

.anchor-item.is-target {
  border-color: rgba(109, 124, 255, 0.5);
  background: rgba(109, 124, 255, 0.1);
}

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #dfe5ff;
  background: linear-gradient(135deg, rgba(109, 124, 255, 0.35), rgba(53, 214, 232, 0.25));
}

.anchor-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.anchor-info strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anchor-info span {
  color: var(--muted);
  font-size: 11.5px;
}

.live-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(61, 220, 151, 0.7);
}

.anchor-check {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 11px;
  transition: background 0.15s;
}

.anchor-item.is-target .anchor-check {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 2px 10px rgba(91, 107, 255, 0.45);
}

.empty {
  padding: 24px 12px;
  text-align: center;
  color: #6c788c;
  font-size: 13px;
  line-height: 1.7;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.history {
  max-height: 320px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.history-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.history-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.room-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 0;
  font-size: 12px;
}

.text-danger {
  border: 0;
  background: none;
  padding: 4px;
  color: #a97582;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.text-danger:hover {
  color: var(--danger);
}

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  max-width: min(90vw, 480px);
  transform: translateX(-50%) translateY(12px);
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(18, 26, 44, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 移动端 ---------- */

@media (max-width: 560px) {
  .auth-view {
    padding: 24px 14px 20px;
    gap: 18px;
  }

  .room-view {
    padding: 14px 12px 32px;
    gap: 12px;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #room-id-display {
    font-size: 26px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    padding-bottom: 0;
  }

  .send-row {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .send-row .counter {
    text-align: right;
  }

  #send-btn {
    width: 100%;
    padding: 13px;
  }


  .room-head h2 {
    font-size: 17px;
  }

  .online-stat strong {
    font-size: 24px;
  }

  .history {
    max-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 企业选择 ---------- */

.org-view {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.org-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-chip .avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 15px;
}

.user-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-text strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-text span {
  color: var(--muted);
  font-size: 12px;
}

.org-head {
  padding: 6px 2px 2px;
}

.org-head h1 {
  font-size: 24px;
}

.org-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.org-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.org-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-card);
}

.org-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
  color: #dfe5ff;
  background: linear-gradient(135deg, rgba(109, 124, 255, 0.4), rgba(53, 214, 232, 0.25));
}

.org-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.org-info strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-info span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.inline-form {
  display: flex;
  gap: 10px;
}

.inline-form input {
  flex: 1;
  min-width: 0;
}

.inline-form .btn {
  flex: 0 0 auto;
}

.room-ident .org-title {
  margin-top: 3px;
  font-size: 26px;
  letter-spacing: 0.01em;
}

.stat-group {
  flex: 0 0 auto;
  display: flex;
  gap: 26px;
}

.stat-group .online-stat {
  text-align: right;
}

/* ---------- 主播行与移除 ---------- */

.anchor-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.anchor-row .anchor-item {
  flex: 1;
  min-width: 0;
}

.remove-anchor {
  flex: 0 0 auto;
  align-self: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 107, 129, 0.28);
  border-radius: 12px;
  background: rgba(255, 107, 129, 0.08);
  color: #ffb3bf;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}

.remove-anchor:hover {
  background: rgba(255, 107, 129, 0.16);
  border-color: rgba(255, 107, 129, 0.5);
}

.anchor-item.is-offline {
  opacity: 0.55;
  cursor: default;
}

.anchor-item.is-offline:hover {
  border-color: var(--line);
}

.offline-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5a6477;
}

@media (max-width: 560px) {
  .org-view {
    padding: 16px 12px 32px;
    gap: 12px;
  }

  .org-head h1 {
    font-size: 21px;
  }

  .org-row {
    padding: 12px;
  }

  .org-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 16px;
  }

  .room-ident .org-title {
    font-size: 22px;
  }

  .stat-group {
    gap: 18px;
  }

  .inline-form .btn {
    padding: 12px 14px;
  }

  .remove-anchor {
    padding: 9px 10px;
    font-size: 12px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* ---------- 工作台布局 ---------- */

.room-view {
  max-width: 1120px;
}

.top-stats {
  margin-left: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* 通知记录侧边栏 */
.history-sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 40px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-card);
}

.sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-head h3 {
  font-size: 15.5px;
}

.sidebar-head .muted {
  font-size: 11.5px;
}

.history-sidebar .history {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 2px;
}

.history-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
}

.history-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.history-meta {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.history-send {
  align-self: flex-end;
  border: 1px solid rgba(109, 124, 255, 0.35);
  border-radius: 8px;
  background: rgba(109, 124, 255, 0.12);
  color: #c9d0ff;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.history-send:hover {
  background: rgba(109, 124, 255, 0.22);
  border-color: rgba(109, 124, 255, 0.55);
}

/* 主播卡片（横向网格） */
.anchor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.anchor-empty {
  grid-column: 1 / -1;
}

.anchor-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.anchor-card:hover {
  border-color: var(--line-strong);
}

.anchor-card.is-target {
  border-color: rgba(109, 124, 255, 0.6);
  background: rgba(109, 124, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(109, 124, 255, 0.2);
}

.anchor-card.is-offline {
  opacity: 0.6;
  cursor: default;
}

.anchor-card.is-offline:hover {
  border-color: var(--line);
}

.anchor-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.anchor-card-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.anchor-card-title strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anchor-card-title span {
  color: var(--muted);
  font-size: 11px;
}

.anchor-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.anchor-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5a6477;
}

.status-dot.is-online {
  background: var(--ok);
  box-shadow: 0 0 7px rgba(61, 220, 151, 0.8);
}

.anchor-card .remove-anchor {
  align-self: auto;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

/* ---------- 设置弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: min(86dvh, 640px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #151d30, #0e1422);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: pop 0.2s ease;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 22px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.settings-card .section-head {
  margin-bottom: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.settings-row span {
  color: var(--muted);
}

.settings-row strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.settings-card .duration-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 0;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-main {
    order: 1;
  }

  .history-sidebar {
    position: static;
    order: 2;
    max-height: 420px;
  }
}

@media (max-width: 560px) {
  .anchor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .anchor-card {
    padding: 11px;
    gap: 9px;
  }

  .anchor-card-title strong {
    font-size: 13px;
  }

  .anchor-card .avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .ident-line {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  #room-id-display {
    font-size: 24px;
  }

  .top-stats {
    flex-basis: 100%;
    margin: 0;
  }

  .history-sidebar {
    max-height: 440px;
  }

  .modal-card {
    padding: 18px;
  }
}

/* ---------- 侧栏标签与常用话术 ---------- */

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sidebar-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-tab.is-active {
  background: rgba(109, 124, 255, 0.16);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(109, 124, 255, 0.36);
}

.sidebar-hint {
  margin: 0 2px 10px;
  color: #6c788c;
  font-size: 11.5px;
  line-height: 1.5;
}

.sidebar-panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

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

.quick-add {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.quick-add input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  font-size: 14px;
}

.quick-add .btn {
  flex: 0 0 auto;
  padding: 9px 12px;
  font-size: 13px;
}

.history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.history-actions .history-send {
  align-self: auto;
}

.history-fav {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 5px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.history-fav:hover {
  color: #ffd479;
  border-color: rgba(255, 212, 121, 0.4);
}

.quick-remove {
  border: 0;
  background: none;
  padding: 5px 4px;
  color: #a97582;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.quick-remove:hover {
  color: var(--danger);
}
