:root {
  color-scheme: dark;
  
  /* 默认深色模式变量 */
  --bg: #05070a;
  --bg-strong: #0a0c12;
  --bg-soft: #12161f;
  --panel: rgba(10, 12, 18, 0.82);
  --line: color-mix(in srgb, var(--accent) 12%, transparent);
  --line-strong: color-mix(in srgb, var(--accent) 25%, transparent);
  --text: #e6edf3;
  --text-soft: #8b949e;
  --text-dim: #6e7681;
  --accent: #00f2ff;
  --accent-strong: #00d4e0;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-gradient-start: var(--accent);
  --accent-gradient-end: var(--accent-strong);
  --shell-rail-bg: #0a0f16;
  --shell-rail-border: rgba(255, 255, 255, 0.08);
  
  --green: #3fb950;
  --danger: #f85149;
  --warning: #d29922;
  --shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  --radius-xl: 18px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --nav-width: 82px;
  --rail-width: 64px;
  --sidebar-width: 320px;
  --sidebar-panel-bg: var(--bg-strong);
  --sidebar-panel-control-bg: var(--bg-soft);
  --main-panel-bg: var(--bg-soft);
  --sidebar-panel-hover-bg: color-mix(in srgb, var(--text-dim) 10%, var(--sidebar-panel-bg));
  --sidebar-panel-hover-strong-bg: color-mix(in srgb, var(--text-dim) 14%, var(--sidebar-panel-bg));
  --login-width: 1180px;
  --font-display: "Avenir Next", "Segoe UI Variable Display", "PingFang SC", sans-serif;
  --font-body: "IBM Plex Sans", "PingFang SC", "Segoe UI Variable", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Menlo", monospace;
  
  --page-gradient-bg: var(--bg);
}

:root.light-mode {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-strong: #ffffff;
  --bg-soft: #f2f3f5;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.11);
  --text: #181818;
  --text-soft: #888888;
  --text-dim: #999999;
  --accent: #559EFF; /* 默认浅色主题为经典蓝 */
  --accent-strong: #4A90D9;
  --accent-soft: rgba(85, 158, 255, 0.1);
  --accent-gradient-start: #559EFF;
  --accent-gradient-end: #559EFF;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shell-rail-bg: #efefef;
  --shell-rail-border: rgba(0, 0, 0, 0.08);
  --sidebar-panel-bg: #f4f4f4;
  --sidebar-panel-control-bg: #ffffff;
  --main-panel-bg: #ffffff;
  --sidebar-panel-hover-bg: #eceef1;
  --sidebar-panel-hover-strong-bg: #e3e6ea;
  --page-gradient-bg: #f5f6f8;
}

:root[data-theme="purple_pink"] {
  --accent: #B172EB;
  --accent-strong: #9778F0;
  --accent-soft: rgba(177, 114, 235, 0.1);
  --accent-gradient-start: #9778F0;
  --accent-gradient-end: #CB6CE6;
}

:root[data-theme="blue"] {
  --accent: #559EFF;
  --accent-strong: #4A90D9;
  --accent-soft: rgba(85, 158, 255, 0.1);
  --accent-gradient-start: #559EFF;
  --accent-gradient-end: #559EFF;
}

:root[data-theme="teal"] {
  --accent: #25C785;
  --accent-strong: #11998E;
  --accent-soft: rgba(37, 199, 133, 0.1);
  --accent-gradient-start: #11998E;
  --accent-gradient-end: #38EF7D;
}

:root[data-theme="sunset"] {
  --accent: #FF9A5C;
  --accent-strong: #FF6B6B;
  --accent-soft: rgba(255, 154, 92, 0.1);
  --accent-gradient-start: #FF6B6B;
  --accent-gradient-end: #FFE66D;
}

:root[data-theme="ocean"] {
  --accent: #6E64C6;
  --accent-strong: #667EEA;
  --accent-soft: rgba(110, 100, 198, 0.1);
  --accent-gradient-start: #667EEA;
  --accent-gradient-end: #764BA2;
}

:root[data-theme="mint"] {
  --accent: #4BC46B;
  --accent-strong: #00B09B;
  --accent-soft: rgba(75, 196, 107, 0.1);
  --accent-gradient-start: #00B09B;
  --accent-gradient-end: #96C93D;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}

html,
body,
#app {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(var(--accent-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-soft) 1px, transparent 1px),
    radial-gradient(circle at 0% 0%, var(--accent-soft) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, var(--accent-soft) 0%, transparent 40%),
    var(--page-gradient-bg, var(--bg));
  background-size: 32px 32px, 32px 32px, 100% 100%, 100% 100%, 100% 100%;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
}

:root.light-mode body {
  background: var(--bg);
  background-attachment: fixed;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
  color-scheme: dark;
}

select option {
  background: var(--bg-strong);
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.app-root {
  height: 100vh;
  overflow: hidden;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-brand,
.login-card,
.app-nav {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.login-brand {
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(10, 12, 18, 0.92), rgba(22, 27, 34, 0.92)),
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%);
}

.login-brand h1,
.login-card h2,
.pane-head h2,
.chat-header h2,
.log-toolbar h2,
.identity-list h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.login-brand h1 {
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  line-height: 0.92;
}

.login-subtitle,
.brand-copy,
.helper-text,
.identity-item-meta,
.session-meta,
.toolbar-note,
.empty-state p,
.message-meta,
.field-help,
.app-badge {
  color: var(--text-soft);
}

.login-subtitle {
  margin: 12px 0 18px;
  font-size: 1.05rem;
  line-height: 1.7;
}

.brand-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.metric-box {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.metric-box strong {
  display: block;
  margin-top: 6px;
  font-size: 1.04rem;
  color: var(--accent);
}

.login-card {
  padding: 28px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 22px 60px rgba(63, 53, 110, 0.08);
  backdrop-filter: blur(20px);
  color: #1f2430;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-logo {
  text-align: center;
  color: var(--accent);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 0 0 24px 0;
  text-shadow: 0 0 25px color-mix(in srgb, var(--accent) 40%, transparent);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 8px;
}

.login-evol-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto;
}

.login-evol-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

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

.login-hero-title {
  margin: 0;
  color: #171717;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-hero-subtitle {
  margin: 0;
  color: #8d9098;
  font-size: 0.95rem;
  line-height: 1.6;
}

.login-flow-tip {
  margin: -2px 0 2px;
  color: #7f748f;
  font-size: 0.9rem;
  line-height: 1.5;
}

.login-restore-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-restore-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c97d14;
  background: #fff6e8;
  border: 1px solid rgba(201, 125, 20, 0.12);
  border-radius: 18px;
}

.login-restore-icon svg {
  width: 30px;
  height: 30px;
}

.login-restore-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  color: #302a23;
  background: #fffaf2;
  border: 1px solid rgba(201, 125, 20, 0.12);
  border-radius: 18px;
}

.login-restore-copy strong {
  font-size: 0.98rem;
}

.login-restore-copy span {
  color: #7b6b58;
  font-size: 0.88rem;
  line-height: 1.6;
}

.login-restore-secondary {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
}

.login-input-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(25, 28, 33, 0.04);
  background: #f6f6f8;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.login-input-shell:focus-within {
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
  background: #f4f3f8;
}

.login-input-shell-code {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.login-input-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c1c3ca;
}

.login-input-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-evol-input {
  border: 0;
  padding: 0;
  background: transparent;
  color: #2a2d35;
  font-size: 0.98rem;
  font-weight: 600;
  box-shadow: none;
}

.login-evol-input::placeholder {
  color: #a5a8b0;
  font-weight: 600;
}

.login-evol-input:focus {
  border-color: transparent;
  box-shadow: none;
}

.login-code-action {
  min-width: 84px;
  padding: 0;
  background: transparent;
  color: #a6a8b0;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.login-code-action:not(:disabled) {
  color: var(--accent);
}

.login-code-action:hover:not(:disabled) {
  color: color-mix(in srgb, var(--accent) 82%, black 18%);
}

.spinner-muted {
  border-color: rgba(145, 149, 160, 0.28);
  border-top-color: currentColor;
}

.login-create-settings {
  margin-top: 4px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 44%),
    color-mix(in srgb, var(--bg-soft) 86%, var(--bg) 14%);
  overflow: hidden;
}

.login-create-settings-summary {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.login-create-settings-summary:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.login-create-settings-summary:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent);
}

.login-create-settings-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 0.92rem;
}

.login-create-settings-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-create-settings-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-create-settings-head strong {
  color: var(--text);
  font-size: 0.95rem;
}

.login-create-settings-head span {
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.login-create-settings-name {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.3;
}

.login-create-settings-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-create-settings-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 88%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.login-create-settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.login-create-settings-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 150ms ease;
}

.login-create-settings.expanded .login-create-settings-toggle svg {
  transform: rotate(180deg);
}

.login-create-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 16px;
  border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  animation: loginCreateSettingsReveal 0.16s ease-out;
}

@keyframes loginCreateSettingsReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-avatar-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}

.login-avatar-preview {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 1rem;
}

.login-avatar-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-avatar-copy strong {
  color: var(--text);
  font-size: 0.93rem;
}

.login-avatar-copy span {
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.login-avatar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.login-avatar-actions .btn {
  min-height: 38px;
  padding: 0 14px;
}

.login-avatar-input {
  display: none;
}

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

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

.aid-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.aid-input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.aid-input {
  border: 0;
  background: transparent;
  padding-right: 8px;
  box-shadow: none;
}

.aid-input:focus {
  border-color: transparent;
  box-shadow: none;
}

.aid-input-shell .group-settings-input.aid-input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-right: 8px;
}

.aid-input-shell .group-settings-input.aid-input:focus {
  border-color: transparent;
  box-shadow: none;
}

.aid-input-suffix {
  padding: 0 16px 0 8px;
  color: var(--text-soft);
  white-space: nowrap;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.phone-code-row {
  display: block;
}

.login-phone-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.privacy-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #7f838d;
  font-size: 0.9rem;
  line-height: 1.5;
}

.privacy-check input {
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin-top: 1px;
  padding: 0;
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #cfd5df;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
  position: relative;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  color-scheme: light;
}

.privacy-check input:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.privacy-check input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
}

.privacy-link {
  margin: 0 4px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.privacy-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.field label,
.field > span,
.identity-list h3,
.pane-label,
.section-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
}

.button-row,
.button-stack,
.toolbar-actions,
.composer-actions,
.composer-footer,
.session-toolbar,
.log-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 4px 12px var(--accent-soft);
}

.login-submit-btn {
  min-height: 56px;
  border-radius: 18px;
  font-size: 1rem;
  box-shadow: none;
}

.login-submit-btn:disabled {
  opacity: 1;
  background: #dddddf;
  color: #9f9fa5;
  box-shadow: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-strong);
  box-shadow: 0 6px 16px var(--accent-soft);
}

.btn.secondary {
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.secondary:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-soft);
}
.btn.ghost {
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.ghost:hover:not(:disabled) {
  background: var(--line);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn.warn {
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  box-shadow: none;
}

.btn.danger {
  background: var(--danger);
  color: #ffffff;
  border: 1px solid var(--danger);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--danger) 20%, transparent);
}

.btn.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 82%, white 18%);
  border-color: color-mix(in srgb, var(--danger) 82%, white 18%);
  color: #ffffff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--danger) 30%, transparent);
}

.btn.ghost-danger {
  background: var(--bg-strong);
  color: var(--danger);
  border: 1px solid var(--line-strong);
  box-shadow: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn.ghost-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

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

.toggle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.toggle-item input {
  width: auto;
  margin: 0;
}

.identity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-entry-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-entry-row .field-help {
  color: #a3b3c4;
  font-size: 0.85rem;
}

.text-entry-btn {
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-strong);
  transition: all 150ms ease;
}

.text-entry-btn:hover:not(:disabled) {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
  text-shadow: 0 0 10px var(--accent-soft);
}

.identity-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
}

.identity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.identity-item strong,
.session-item strong,
.chat-header h2,
.log-toolbar h2,
.file-card strong {
  font-size: 0.98rem;
}

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

.identity-item-actions .btn {
  min-height: 36px;
  padding: 0 12px;
}
.helper-banner {
  padding: 8px 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}

.error-banner {
  padding: 10px 14px;
  background: rgba(255, 106, 106, 0.08);
  border: 1px solid rgba(255, 106, 106, 0.14);
  color: #db5c5c;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-banner::before {
  content: "⚠️";
  font-size: 1rem;
}

.notice-banner {
  padding: 12px 16px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-banner::before {
  content: "💡";
  font-size: 1rem;
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  background: var(--bg-soft);
  color: var(--text-soft);
}

.status-inline.connected {
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
}

.status-inline.connecting {
  background: color-mix(in srgb, var(--warning) 15%, transparent);
  color: var(--warning);
}

.status-inline.error {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}

.app-shell-layout {
  height: 100vh;
  display: flex;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

.app-toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-strong) 82%, rgba(255, 255, 255, 0.08));
  border: 1px solid color-mix(in srgb, var(--line-strong) 78%, rgba(255, 255, 255, 0.18));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  pointer-events: auto;
  animation: fadeIn 0.16s ease;
}

.app-toast-accent {
  width: 3px;
  align-self: stretch;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.app-toast-accent.success {
  background: var(--green);
}

.app-toast-accent.error {
  background: var(--danger);
}

.app-toast-accent.warning {
  background: var(--warning);
}

.app-toast-accent.info {
  background: var(--accent);
}

.app-toast-copy {
  min-width: 0;
  flex: 1;
}

.app-toast-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.app-toast-message {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.app-toast-dismiss {
  width: 24px;
  height: 24px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  flex-shrink: 0;
}

.app-toast-dismiss:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.app-sidebar {
  width: calc(var(--rail-width) + var(--sidebar-width));
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  position: relative;
  background: transparent;
  border-right: 1px solid var(--line);
  height: 100vh;
  z-index: 10;
}

.app-rail {
  width: var(--rail-width);
  flex: 0 0 var(--rail-width);
  height: 100vh;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: var(--shell-rail-bg);
  border-right: 1px solid var(--shell-rail-border);
}

.sidebar-content {
  width: var(--sidebar-width);
  min-width: 0;
  min-height: 0;
  flex: 0 0 var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-panel-bg);
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
  z-index: 20;
}

.sidebar-resize-handle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: transparent;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.sidebar-resize-handle:hover::before,
.app-sidebar.is-resizing .sidebar-resize-handle::before {
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.sidebar-resize-active,
.sidebar-resize-active * {
  cursor: col-resize !important;
  user-select: none !important;
}

.rail-primary,
.rail-secondary {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-primary {
  flex: 1;
}

.rail-secondary {
  flex: 0 0 auto;
}

.rail-profile-button,
.rail-item {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.rail-profile-button:hover,
.rail-item:hover,
.rail-item.active {
  color: var(--accent);
}

.rail-profile-button:active,
.rail-item:active {
  transform: scale(0.96);
}

.rail-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.rail-item svg {
  width: 22px;
  height: 22px;
}

.rail-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.rail-status-dot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--text-dim);
  box-shadow: 0 0 0 2px var(--shell-rail-bg);
}

.rail-status-dot.connected {
  background: var(--green);
}

.rail-status-dot.connecting,
.rail-status-dot.authenticating,
.rail-status-dot.reconnecting {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.rail-status-dot.error,
.rail-status-dot.terminal_failed {
  background: var(--danger);
}

.rail-profile-button::after,
.rail-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 4;
  transform: translate(-4px, -50%);
  padding: 6px 9px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-strong) 92%, var(--text) 8%);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  transition-delay: 0s;
}

.rail-profile-button:focus-visible::after,
.rail-item:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
  transition-delay: 1.5s;
}

@media (hover: hover) and (pointer: fine) {
  .rail-profile-button:hover::after,
  .rail-item:hover::after {
    opacity: 1;
    transform: translate(0, -50%);
    transition-delay: 1.5s;
  }
}

.app-main,
.log-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--main-panel-bg);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.sidebar-content .pane-head {
  background: var(--sidebar-panel-bg);
}

.favorites-pane {
  background: var(--main-panel-bg);
}

.application-notices-pane {
  background: transparent;
}

.application-notices-title-block {
  min-width: 0;
}

.application-notices-title-block h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.application-notices-title-block p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.application-notices-pane-head {
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.favorites-pane-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 24px;
}

.application-notices-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.application-notice-heading {
  display: flex;
  align-items: center;
}

.application-notices-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  text-align: center;
  padding: 0 24px;
}

.application-notices-empty strong {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
}

.application-notices-empty span {
  max-width: 280px;
  line-height: 1.6;
  font-size: 0.85rem;
}

.application-notices-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.04);
  color: rgba(100, 116, 139, 0.9);
}

.application-notices-empty-icon svg {
  width: 26px;
  height: 26px;
}

.application-notice-section {
  display: flex;
  flex-direction: column;
}

.application-notice-row {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  margin: 2px 8px;
  border-radius: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.application-notice-row:hover {
  background: var(--bg-soft);
  transform: translateY(-1px);
}

.application-notice-row.unread {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.application-notice-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  color: var(--text-dim);
}

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

.application-notice-row-approved .application-notice-icon {
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
}

.application-notice-row-rejected .application-notice-icon {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

.application-notice-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.application-notice-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.application-notice-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.application-notice-heading strong {
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.application-notice-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.application-notice-meta time {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.application-notice-source {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.favorites-list.evol-style {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.favorite-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.favorite-row-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: transparent;
  color: inherit;
  border: none;
  text-align: left;
}

.favorite-row-main:hover .favorite-text-preview {
  color: var(--accent);
}

.favorite-type-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-dim);
}

.favorite-type-icon svg {
  width: 22px;
  height: 22px;
}

.favorite-type-icon.text {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-soft));
}

.favorite-type-icon.image {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, transparent);
}

.favorite-type-icon.file {
  color: #ff9f1c;
  background: rgba(255, 159, 28, 0.12);
}

.favorite-type-icon.file.pdf {
  color: #ff4d4f;
}

.favorite-type-icon.file.doc {
  color: #3b82f6;
}

.favorite-type-icon.file.sheet {
  color: #22c55e;
}

.favorite-type-icon.file.slide {
  color: #f59e0b;
}

.favorite-type-icon.file.zip {
  color: #d97706;
}

.favorite-type-icon.file.audio,
.favorite-type-icon.file.video {
  color: #8b5cf6;
}

.favorite-image-thumb {
  overflow: hidden;
  padding: 0;
}

.favorite-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.favorite-row-content {
  flex: 1;
  min-width: 0;
}

.favorite-row-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.favorite-row-origin {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorite-row-origin strong {
  min-width: 0;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-row-origin span,
.favorite-row-meta time {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.favorite-text-preview {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.favorites-empty-state,
.favorites-sidebar-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--text-dim);
}

.favorites-empty-state.with-icon svg {
  width: 56px;
  height: 56px;
  color: var(--text-dim);
}

.favorites-empty-state strong {
  font-size: 1rem;
  color: var(--text-dim);
}

.favorites-empty-state span {
  font-size: 0.84rem;
}

.favorites-filter-row {
  justify-content: flex-start;
}

.favorites-filter-copy {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 600;
}

.favorite-detail-sheet {
  width: min(560px, calc(100vw - 24px));
  max-height: min(76vh, 720px);
  margin-top: auto;
  margin-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--bg-strong);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.favorite-detail-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-dim);
  opacity: 0.35;
  margin: 10px auto 6px;
}

.favorite-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
}

.favorite-detail-sender {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.favorite-detail-time {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.modal-close.floating {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(0, 0, 0, 0.44);
  color: #fff;
  z-index: 10;
}

.favorite-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.favorite-detail-image {
  width: 100%;
  display: flex;
  justify-content: center;
}

.favorite-detail-image img {
  max-width: 100%;
  max-height: 52vh;
  border-radius: 12px;
  display: block;
}

.favorite-detail-file {
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.favorite-detail-file-name {
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.favorite-detail-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  font-family: inherit;
}

.favorite-detail-quote {
  margin-top: 12px;
}

.favorite-detail-quote .quote-preview {
  max-width: 100%;
}

.favorite-detail-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.favorite-detail-actions .btn {
  flex: 1;
}

.favorite-image-viewer {
  background: rgba(0, 0, 0, 0.88);
}

.favorite-image-viewer img {
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  display: block;
}

.favorite-sidebar-panel {
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.favorite-sidebar-searching {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 600;
}

.favorite-category-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.favorite-category-item {
  width: 100%;
  min-height: 42px;
  border: none;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}

.favorite-category-item {
  cursor: pointer;
}

.favorite-category-item:hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.favorite-category-item.active {
  background: color-mix(in srgb, var(--text) 11%, transparent);
}

.favorite-category-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  flex-shrink: 0;
}

.favorite-category-icon svg {
  width: 19px;
  height: 19px;
}

.favorite-category-item.active .favorite-category-icon,
.favorite-category-item.active .favorite-category-label {
  color: var(--text);
}

.favorite-category-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
}

.favorite-category-count {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 0.74rem;
}

.favorites-content-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.favorites-content-head {
  min-height: 54px;
  padding: 16px 56px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-strong);
}

.favorites-content-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0;
}

.favorites-content-search-summary {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.favorites-content-area .favorites-pane-body {
  padding: 14px 24px;
}

.favorites-list.wechat-style {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.favorite-card {
  position: relative;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-soft) 84%, var(--bg-strong));
  overflow: hidden;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.favorite-card-main {
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.favorite-card-content-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.favorite-card-content-row.has-side-icon {
  align-items: center;
}

.favorite-card-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.favorite-card-topline,
.favorite-card-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.favorite-card-foot-right > span {
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.favorite-card-media {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-card-media.favorite-card-file-media {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  overflow: visible;
}

.favorite-card-media.favorite-card-link-media {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  overflow: visible;
}

.favorite-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.favorite-card-media .favorite-type-icon {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
}

.favorite-card-media.favorite-card-file-media .file-icon {
  width: 44px;
  height: 44px;
}

.favorite-link-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.favorite-link-icon svg {
  width: 22px;
  height: 22px;
}

.favorite-card .favorite-text-preview {
  min-height: 0;
  flex: 1;
  font-size: 0.93rem;
  line-height: 1.5;
  -webkit-line-clamp: 2;
}

.favorite-text-preview-full {
  display: block;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-line-clamp: unset;
}

.favorite-text-tooltip {
  position: fixed;
  z-index: 320;
  width: min(420px, calc(100vw - 24px));
  max-height: min(260px, calc(100vh - 24px));
  padding: 14px 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg-strong) 96%, transparent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
}

.favorite-text-tooltip.is-above::before,
.favorite-text-tooltip.is-below::before {
  content: "";
  position: absolute;
  left: 24px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-left: 1px solid var(--line-strong);
  border-top: 1px solid var(--line-strong);
  transform: rotate(45deg);
}

.favorite-text-tooltip.is-below::before {
  top: -6px;
}

.favorite-text-tooltip.is-above::before {
  bottom: -6px;
  transform: rotate(225deg);
}

.favorite-text-tooltip-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
}

.favorite-text-tooltip-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.favorite-text-tooltip-close svg {
  width: 14px;
  height: 14px;
}

.favorite-text-tooltip-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 32px;
  margin-bottom: 10px;
}

.favorite-text-tooltip-sender {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.favorite-text-tooltip-time {
  color: var(--text-dim);
  font-size: 0.74rem;
}

.favorite-text-tooltip-body {
  max-height: calc(min(260px, calc(100vh - 24px)) - 64px);
  overflow: auto;
}

.favorite-text-tooltip-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
  font-family: inherit;
}

.favorite-card-foot {
  padding-top: 8px;
  align-items: center;
}

.favorite-card-foot-right {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorite-card-origin {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.favorite-card-origin span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 0.76rem;
}

.favorite-remove-confirm h2 {
  margin-bottom: 12px;
}

@media (max-width: 1180px) {
  .favorites-content-head,
  .favorites-content-area .favorites-pane-body {
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 920px) {
  .favorite-category-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .favorites-content-head,
  .favorites-content-area .favorites-pane-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 560px) {
  .favorites-list.wechat-style {
    width: 100%;
  }
}


.footer-icon-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-unread-dot {
  position: absolute;
  top: -1px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg-strong);
}

.footer-unread-badge {
  position: absolute;
  top: -7px;
  right: -12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg-strong);
}

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

.user-profile-button {
  width: 100%;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 10px;
  transition: background 150ms ease, transform 150ms ease;
}

.user-profile-button:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.user-profile-button:active {
  transform: scale(0.995);
}

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

.aid-avatar,
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.34), transparent 30%),
    linear-gradient(135deg, var(--avatar-start, var(--accent-gradient-start)) 0%, var(--avatar-end, var(--accent-gradient-end)) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 0 15px color-mix(in srgb, var(--accent) 24%, transparent);
  flex-shrink: 0;
}

.aid-avatar span {
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}

.aid-avatar-image {
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

.user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.user-info h3 {
  min-width: 0;
  font-size: 0.98rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

@keyframes breathing-dot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.user-status-text {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.user-status-text.connected .status-dot {
  animation: breathing-dot 2.5s ease-in-out infinite;
  box-shadow: 0 0 8px currentColor;
}

.user-status-text.connected {
  color: var(--accent);
}

.user-status-text.connecting {
  color: var(--warning);
  animation: pulse 1.5s infinite;
}

.user-status-text.error {
  color: var(--danger);
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.btn-icon {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 120ms ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-icon:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 20%, transparent);
}

.btn-icon-warning:hover {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 24%, transparent);
}

.pane-head,
.chat-header,
.log-toolbar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  background: var(--bg-strong);
  flex-shrink: 0;
}

.chat-header {
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.group-approval-banner {
  padding: 12px 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), rgba(255, 255, 255, 0.02)),
    var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text);
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.group-approval-banner:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), rgba(255, 255, 255, 0.03)),
    var(--bg-soft);
  transform: translateY(-1px);
}

.group-approval-banner-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.group-approval-banner-action {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.82rem;
}

.btn-header {
  background: transparent;
  color: var(--text-soft);
  border: none;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-header:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-header svg {
  opacity: 0.8;
}

.btn-header:hover svg {
  opacity: 1;
}

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

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), rgba(255, 255, 255, 0.02));
  color: var(--text);
  max-width: min(260px, 100%);
  flex: 0 1 auto;
}

.topic-pill-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

.topic-pill-caret {
  color: var(--text-dim);
  font-size: 11px;
  flex: 0 0 auto;
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-soft);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
}

.status-pill.connected {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 20%, transparent);
  background: color-mix(in srgb, var(--green) 6%, transparent);
}

.btn-action {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  transition: all 120ms ease;
  cursor: pointer;
}

.btn-action:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-action.outline {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-action.outline:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--text-dim);
}

.pane-head h2 {
  font-size: 1.16rem;
}

.session-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-strong);
}

.session-toolbar .field {
  gap: 0;
}

.session-toolbar .field span {
  display: none;
}

.session-toolbar input {
  background: var(--bg-soft);
  padding: 8px 12px;
  font-size: 0.88rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
}

.session-toolbar-v2 {
  padding: 8px 16px 10px;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.search-and-plus {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-bar-shell {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--sidebar-panel-control-bg) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  min-height: 38px;
  padding: 7px 40px 7px 32px !important;
  font-size: 0.88rem !important;
  transition: all 150ms ease !important;
}

.search-input:focus {
  border-color: var(--accent) !important;
  background: var(--sidebar-panel-control-bg) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

.search-clear-btn {
  position: absolute;
  right: 9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.search-clear-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.04);
}

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

.plus-action-container {
  position: relative;
}

.plus-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  font-size: 18px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
  line-height: 1;
  padding: 0;
  box-shadow: none;
}

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

.plus-action-btn:hover,
.plus-action-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

.plus-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.plus-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 101;
  backdrop-filter: blur(24px);
  animation: slideIn 150ms ease;
}

.quick-action-menu {
  min-width: 184px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

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

.quick-action-item {
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}

.quick-action-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.quick-action-icon svg {
  width: 22px;
  height: 22px;
}

.quick-action-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

.action-modal {
  width: 400px !important;
}

.sidebar-action-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: slideRight 200ms ease;
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.action-panel-head {
  justify-content: space-between;
  padding: 12px 16px;
}

.action-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.back-btn {
  font-size: 1.4rem;
  background: transparent;
  border: none;
  padding: 0 8px 0 0;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
  line-height: 1;
}

.back-btn:hover {
  transform: translateX(-4px);
  color: var(--accent);
}

.action-title {
  font-size: 1.1rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-panel-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
}

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

.create-group-form {
  gap: 18px;
}

.create-group-selector {
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-form-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
}

.choice-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-card {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-card:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.choice-card.selected {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.choice-card-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.choice-card-copy strong {
  font-size: 0.96rem;
}

.choice-card-copy span {
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.duty-card {
  align-items: center;
}

.choice-indicator {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  position: relative;
}

.choice-indicator.selected {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.choice-indicator.selected::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.action-panel-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
  line-height: 1.5;
}

.create-group-selected-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.create-group-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}

.create-group-selected-chip:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.create-group-selected-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.create-group-selected-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}

.create-group-selected-remove {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1;
}

.create-group-contact-picker {
  flex: 1;
  min-height: 0;
}

.create-group-contact-list {
  min-height: 260px;
}

.action-panel-footer {
  padding: 16px 24px 22px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: linear-gradient(180deg, rgba(5, 7, 10, 0) 0%, rgba(10, 12, 18, 0.96) 24%);
}

.action-panel-btn {
  width: 100%;
}

.session-filter-row {
  display: flex;
  background: transparent;
  padding: 0;
  margin-bottom: 8px;
  gap: 8px;
}

.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  transition: all 150ms ease;
  user-select: none;
}

.custom-select-trigger:hover {
  border-color: var(--accent);
}

.dropdown-arrow {
  font-size: 0.6rem;
  color: var(--text-dim);
}

.custom-select-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--bg-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  z-index: 100;
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  backdrop-filter: blur(24px);
}

.custom-select-item {
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 0.88rem;
  transition: all 120ms ease;
  user-select: none;
}

.custom-select-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.custom-select-item.selected {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-weight: 700;
}

.filter-btn {
  flex: none;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  border-radius: 6px;
  background: transparent;
  transition: all 120ms ease;
  border: none;
  cursor: pointer;
}

.filter-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

.session-list-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

.session-list {
  --session-divider-left: 70px;
  --session-divider-right: 16px;
  --contact-divider-right: 12px;
  width: 100%;
  height: 100%;
  padding: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  background: transparent;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}

.session-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.session-list-scrollbar {
  position: absolute;
  top: 0;
  right: 2px;
  bottom: 0;
  width: 6px;
  z-index: 6;
  cursor: default;
  pointer-events: auto;
  touch-action: none;
}

.session-list-scrollbar-thumb {
  width: 100%;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0);
  transition: background 120ms ease;
  will-change: transform;
  cursor: grab;
  touch-action: none;
}

.session-list-scrollbar-thumb:active {
  cursor: grabbing;
}

.session-list-shell:hover .session-list-scrollbar-thumb,
.session-list-scrollbar.is-visible .session-list-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.2);
}

.session-list-shell:hover .session-list-scrollbar-thumb:hover,
.session-list-scrollbar.is-visible .session-list-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.4);
}

.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex-shrink: 0;
}

.contacts-accordion {
  display: flex;
  flex-direction: column;
}

.contact-applications-list {
  gap: 0;
}

.contact-applications-empty {
  min-height: 72px;
  padding: 18px 24px 22px;
}

.contact-application-row {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  position: relative;
  transition: background 120ms ease;
}

.contact-application-row::after {
  content: "";
  position: absolute;
  left: var(--session-divider-left);
  right: var(--session-divider-right);
  bottom: 0;
  height: 1px;
  background: var(--line);
}

.contact-application-row:hover {
  background: var(--sidebar-panel-hover-bg);
}

.contact-application-row.unread .session-title-row strong {
  color: var(--text);
}

.contact-application-dot {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff4d4f;
  box-shadow: 0 0 0 2px var(--sidebar-panel-bg);
}

.contact-application-status {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 600;
}

.contact-application-status.status-pending {
  color: var(--accent);
}

.accordion-section {
  display: flex;
  flex-direction: column;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 8px;
  transition: background 150ms ease;
  user-select: none;
}

.accordion-header:hover {
  background: color-mix(in srgb, var(--text-dim) 6%, transparent);
}

.accordion-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text);
  transition: transform 200ms ease;
}

.accordion-section.is-expanded .accordion-arrow {
  transform: rotate(90deg);
}

.accordion-arrow svg {
  width: 20px;
  height: 20px;
}

.accordion-title {
  flex: 1;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.accordion-count {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}

.accordion-content {
  display: flex;
  flex-direction: column;
}

.contact-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-section-title {
  position: sticky;
  top: -8px;
  z-index: 1;
  padding: 10px 12px 5px;
  background: var(--sidebar-panel-bg);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.contact-item {
  align-items: center;
}

.contact-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 12px;
  position: relative;
  transition: background 120ms ease;
}

.contact-item-row:hover {
  background: var(--sidebar-panel-hover-bg);
}

.contact-item-row.active {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent-gradient-start) 18%, var(--bg-strong)),
      color-mix(in srgb, var(--accent-gradient-end) 12%, var(--bg-strong))
    );
}

.contact-item-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-gradient-start), var(--accent-gradient-end));
  border-radius: 0 4px 4px 0;
  pointer-events: none;
}

.contact-item-row::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--session-divider-left);
  right: var(--contact-divider-right);
  height: 1px;
  background: var(--line);
  pointer-events: none;
}

.contact-item-main {
  flex: 1;
  min-width: 0;
  background: transparent;
}

.contact-item-main::after {
  display: none;
}

.contact-item-action {
  width: 36px;
  height: 36px;
  margin-right: 2px;
  border-radius: 12px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: transparent;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease, opacity 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .contact-item-action {
    opacity: 0;
    pointer-events: none;
  }

  .contact-item-row:hover .contact-item-action,
  .contact-item-row:focus-within .contact-item-action,
  .contact-item-action:focus-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

.contact-item-action svg {
  width: 18px;
  height: 18px;
}

.contact-item-action:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.contact-item-action:active {
  transform: scale(0.96);
}

.contact-item-action:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--danger) 40%, white);
  outline-offset: 2px;
}

.contact-item-row .session-item:hover {
  background: transparent;
}

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

.contact-empty-state {
  flex: 1;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-dim);
}

.contact-empty-state svg {
  width: 58px;
  height: 58px;
  color: color-mix(in srgb, var(--text-dim) 42%, transparent);
  margin-bottom: 2px;
}

.contact-empty-state strong {
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 700;
}

.contact-empty-state span {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.contact-empty-state.is-search-empty {
  min-height: 260px;
  gap: 0;
}

.contact-empty-state.is-search-empty strong {
  color: var(--text-dim);
  font-size: 0.94rem;
  font-weight: 700;
}

.session-item {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 16px;
  border-radius: 0;
  background: transparent;
  border: none;
  overflow: hidden;
  transition: background 120ms ease;
  color: var(--text);
  flex-shrink: 0;
  position: relative;
}

.session-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--session-divider-left);
  right: var(--session-divider-right);
  height: 1px;
  background: var(--line);
}

.session-item:hover {
  background: var(--sidebar-panel-hover-bg);
}

.session-item.pinned {
  background: var(--sidebar-panel-hover-bg);
}

.session-item.pinned:hover {
  background: var(--sidebar-panel-hover-strong-bg);
}

.session-item.muted .session-preview,
.session-item.muted .session-meta {
  color: var(--text-dim);
}

.session-item.active {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent-gradient-start) 18%, var(--bg-strong)),
      color-mix(in srgb, var(--accent-gradient-end) 12%, var(--bg-strong))
    );
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  position: relative;
}

.session-item.pinned.active {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent-gradient-start) 22%, var(--bg-strong)),
      color-mix(in srgb, var(--accent-gradient-end) 15%, var(--bg-strong))
    );
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

.session-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-gradient-start), var(--accent-gradient-end));
  border-radius: 0 4px 4px 0;
}

.session-avatar,
.message-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.message-avatar-button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}

.message-avatar-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.session-avatar.group {
  color: #fff;
}

.session-avatar-wrapper {
  width: 42px;
  height: 42px;
  position: relative;
  flex-shrink: 0;
}

.session-body {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.session-main {
  min-width: 0;
  flex: 1;
}

.session-meta-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 4px;
}

.session-badges {
  display: flex;
  gap: 4px;
  align-items: center;
}

.session-title-row,
.message-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.session-title-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.session-pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
}

.session-pin-badge svg {
  width: 13px;
  height: 13px;
}

.session-mute-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.session-mute-badge svg {
  width: 14px;
  height: 14px;
}

.session-title-row strong {
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-preview {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.search-section {
  display: flex;
  flex-direction: column;
}

.search-section-title {
  padding: 12px 14px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
}

.search-result-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-history-body {
  min-width: 0;
}

.search-result-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.search-result-snippet {
  margin-top: 6px;
}

.search-result-snippet-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-prefix {
  color: var(--text-dim);
}

.search-history-match-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-history-match {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
}

.search-history-match:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-history-match-direct .search-history-match-meta {
  display: none;
}

.search-history-match-direct .search-result-snippet {
  margin-top: 0;
}

.search-history-match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-history-match-sender,
.search-history-match-time {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.search-history-match-sender {
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-history-match-time {
  flex-shrink: 0;
}

.search-result-snippet-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-history-match-time-inline {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.search-history-toggle {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
}

.search-history-toggle:hover {
  color: var(--accent-strong);
}

.search-match-count {
  margin-top: 3px;
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1.35;
}

.search-result-item mark {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 2px;
}

.search-loading-row {
  padding: 12px 16px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.session-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff4d4f;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.badge-on-avatar {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 2;
  box-shadow: 0 0 0 2px var(--bg-strong);
}

.pane-empty,
.empty-state,
.log-empty {
  flex: 1;
  padding: 48px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-dim);
}

.empty-state-card {
  max-width: 420px;
  animation: fadeIn 0.8s ease-out;
}

.empty-state-visual {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visual-blob {
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--accent);
  filter: blur(36px);
  opacity: 0.12;
  border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%;
  animation: blobMorph 8s infinite alternate ease-in-out, pulseScale 4s infinite ease-in-out;
}

.visual-icon {
  position: relative;
  z-index: 1;
  color: var(--accent);
  filter: drop-shadow(0 0 12px var(--accent-soft));
  opacity: 0.9;
  transition: transform 0.3s ease;
}

.empty-state-card:hover .visual-icon {
  transform: scale(1.1) rotate(-5deg);
}

.empty-state-body h2 {
  font-size: 1.8rem;
  margin-bottom: 16px;
  color: var(--text);
  font-family: var(--font-display);
}

.empty-state-body p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-soft);
}

@keyframes blobMorph {
  0% { border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%; }
  100% { border-radius: 62% 38% 37% 63% / 59% 56% 44% 41%; }
}

@keyframes pulseScale {
  0%, 100% { transform: scale(1); opacity: 0.12; }
  50% { transform: scale(1.15); opacity: 0.18; }
}

.session-context-menu {
  position: fixed;
  z-index: 220;
  min-width: 144px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.session-context-menu.expand-down {
  transform-origin: top left;
  animation: sessionContextMenuExpandDown 150ms ease;
}

.session-context-menu.expand-up {
  transform-origin: bottom left;
  animation: sessionContextMenuExpandUp 150ms ease;
}

@keyframes sessionContextMenuExpandDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.session-context-menu-item {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 120ms ease, color 120ms ease;
}

.session-context-menu-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.session-context-menu-icon svg {
  width: 16px;
  height: 16px;
}

.session-context-menu-separator {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.session-context-menu-item.danger {
  color: var(--danger);
}

.session-context-menu-item:hover {
  background: var(--accent);
  color: #ffffff;
}

.session-context-menu-item.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.session-delete-confirm-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.session-delete-confirm-actions {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.session-delete-confirm-actions .btn {
  width: 100%;
}

/* Chat Settings Drawer */
.chat-drawer-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 100;
}

.chat-drawer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  animation: slideInRight 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  box-shadow: -4px 0 24px var(--shadow);
}

.settings-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.18);
  animation: fadeIn 0.14s ease-out;
}

.settings-left-drawer {
  position: relative;
  width: min(720px, 100%);
  height: min(560px, calc(100vh - 48px));
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  z-index: 211;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  overflow: hidden;
  animation: settingsModalIn 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}

.settings-modal-sidebar {
  min-width: 0;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 88%, var(--bg-strong));
}

.settings-modal-title {
  padding: 0 10px 14px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-nav-item {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.settings-nav-item svg {
  flex: 0 0 auto;
  color: var(--text-soft);
}

.settings-nav-item:hover,
.settings-nav-item:focus-visible {
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.settings-nav-item.active {
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.settings-nav-item.active svg {
  color: var(--accent);
}

.settings-modal-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.settings-modal-header {
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}

.settings-modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}

.settings-drawer-content {
  background: var(--bg);
  padding: 18px;
  gap: 16px;
}

.settings-card {
  background: var(--bg-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.settings-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 0;
}

.settings-toggle-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.settings-toggle-main.with-icon {
  align-items: center;
}

.settings-toggle-copy {
  min-width: 0;
}

.settings-toggle-title {
  font-weight: 500;
  font-size: 0.95rem;
}

.settings-toggle-description {
  color: var(--text-soft);
  font-size: 0.78rem;
  margin-top: 4px;
}

.settings-switch {
  width: 46px;
  height: 26px;
  background: #e4e4e4;
  border: 1px solid #d1d1d1;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.settings-switch.checked {
  background: color-mix(in srgb, var(--accent) 24%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.settings-switch-thumb {
  width: 20px;
  height: 20px;
  background: #888;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s, background 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  display: block;
}

.settings-switch.checked .settings-switch-thumb {
  left: 22px;
  background: var(--accent);
}

.settings-section-label {
  padding: 15px 18px 0;
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.settings-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
  margin-bottom: 0;
}

.settings-theme-tile {
  background: linear-gradient(135deg, var(--settings-theme-start), var(--settings-theme-end));
  border: none;
  border-radius: 12px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  padding: 0;
}

.settings-theme-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-switch:focus-visible,
.settings-theme-tile:focus-visible,
.settings-nav-item:focus-visible,
.settings-action-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.settings-action-button {
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

.settings-action-button + .settings-action-button {
  border-top: 1px solid var(--line);
}

.settings-action-button:hover,
.settings-action-button:focus-visible {
  background: var(--bg-soft);
}

.settings-action-button.danger {
  color: var(--danger);
}

.settings-action-button.danger:hover,
.settings-action-button.danger:focus-visible {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

@keyframes settingsModalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .settings-drawer-overlay {
    padding: 10px;
  }

  .settings-left-drawer {
    height: min(640px, calc(100vh - 20px));
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-modal-sidebar {
    padding: 12px 12px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-modal-title {
    padding: 0 2px 10px;
  }

  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .settings-nav-item {
    width: auto;
    flex: 0 0 auto;
    padding: 0 12px;
  }

  .settings-modal-header {
    height: 56px;
  }

  .settings-drawer-content {
    padding: 14px;
  }

  .settings-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.slash-command-drawer-overlay {
  position: fixed;
  z-index: 210;
  background: transparent;
}

.slash-command-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  max-width: 100%;
  z-index: 211;
  box-shadow: -8px 0 28px var(--shadow);
}

.slash-command-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.slash-command-confirm-box {
  width: min(420px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-strong);
  box-shadow: 0 18px 48px var(--shadow);
  padding: 24px;
}

.slash-command-confirm-box h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.slash-command-confirm-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.slash-command-confirm-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes slideInRight {
  to { transform: translateX(0); }
}

@keyframes slideInLeft {
  to { transform: translateX(0); }
}

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

.drawer-header {
  padding: 0 20px;
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-strong);
  flex-shrink: 0;
}

.drawer-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-card {
  background: var(--bg-strong);
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.drawer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  text-align: left;
}

.drawer-item:last-child {
  border-bottom: none;
}

.drawer-item.clickable:hover {
  background: var(--bg-soft);
}

.drawer-item-arrow {
  color: var(--text-dim);
  font-weight: bold;
}

.drawer-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  background: var(--bg-strong);
  border-bottom: 1px solid var(--line);
}

.drawer-avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.drawer-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

/* Modal additions */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.modal-box {
  background: var(--bg-strong);
  width: 90%;
  max-width: 400px;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px var(--shadow);
}

.modal-box h2 {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
}

.btn-action.danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-action.danger:hover {
  background: color-mix(in srgb, var(--danger) 82%, white 18%);
  color: #fff;
  border-color: color-mix(in srgb, var(--danger) 82%, white 18%);
}

.group-settings-overlay {
  background: transparent;
  backdrop-filter: none;
}

.group-settings-modal-overlay {
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.group-settings-drawer {
  width: 420px;
  max-width: min(420px, 100%);
}

.group-settings-side-drawer-layer {
  position: absolute;
  inset: 0;
  z-index: 220;
  pointer-events: none;
}

.group-settings-side-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

.group-settings-side-drawer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  max-width: min(420px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  box-shadow: -4px 0 24px var(--shadow);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  transform: translateX(100%);
  animation: slideInRight 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.aid-profile-overlay {
  z-index: 102;
}

.aid-profile-drawer {
  width: 420px;
  max-width: min(420px, 100%);
  z-index: 103;
  position: absolute;
  overflow: hidden;
}

/* Inline Popover Styles */
.group-settings-popover-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: transparent;
}

.group-settings-popover {
  position: fixed;
  background: var(--bg-strong);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 6px;
  min-width: 160px;
  z-index: 2100;
  animation: popoverIn 0.15s ease;
  backdrop-filter: blur(20px);
}

.group-settings-popover-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  text-align: left;
}

.group-settings-popover-item:hover {
  background: var(--accent);
  color: #ffffff;
}

.group-settings-popover-item.selected {
  background: transparent;
  color: var(--accent);
  font-weight: 500;
}

.group-settings-popover-item.selected:hover {
  background: var(--accent);
  color: #ffffff;
}

.group-settings-popover-item.selected .group-settings-check {
  color: var(--accent);
}

.group-settings-popover-item:hover .group-settings-check {
  color: #ffffff;
}

.group-settings-popover-separator {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.group-settings-popover-item.danger {
  color: var(--danger);
}

.group-settings-popover-item.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

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

.group-settings-header {
  padding: 0 16px 0 12px;
}

.group-settings-header-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.group-settings-header-main h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-settings-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.group-settings-content {
  gap: 14px;
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 40%),
    linear-gradient(180deg, var(--accent-soft), transparent 30%),
    var(--bg);
}

.group-settings-banner {
  margin: 12px 20px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  border: 1px solid var(--line);
}

.group-settings-banner.success {
  background: color-mix(in srgb, var(--green) 8%, transparent);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 18%, transparent);
}

.group-settings-banner.error,
.group-settings-inline-error {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 16%, transparent);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.group-settings-inline-warning {
  margin-top: 12px;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 18%, transparent);
}

.group-settings-section {
  margin-bottom: 20px;
  background: var(--bg-strong);
}

.group-settings-card {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.group-settings-row {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  cursor: default;
}

.group-settings-row:first-child {
  border-top: none;
}

.group-settings-row.clickable {
  cursor: pointer;
}

.group-settings-row.clickable:hover {
  background: rgba(255, 255, 255, 0.04);
}

.slash-command-actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  flex-shrink: 0;
}

.slash-command-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.slash-command-action-btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
  transform: translateY(-1px);
}

.slash-command-action-btn.danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 22%, transparent);
  color: var(--danger);
}

.slash-command-action-btn svg {
  display: block;
}

.slash-command-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.slash-command-add-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  transform: translateY(-1px);
}

.slash-command-add-btn svg {
  display: block;
}

.group-settings-member-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 20px;
  background: var(--bg-strong);
  margin-bottom: 20px;
}

.group-settings-member-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 0;
}

.group-settings-member-item .aid-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.group-settings-member-name {
  font-size: 0.72rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.group-settings-member-add {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  background: transparent;
  transition: all 0.2s;
}

.group-settings-member-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.add-member-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  padding: 24px;
}

.add-member-drawer-body .create-group-search-field {
  gap: 0;
}

.add-member-drawer-body .create-group-selected-section {
  margin-top: -2px;
}

.add-member-drawer-body .create-group-selected-strip {
  gap: 14px;
  padding: 2px 2px 4px;
}

.add-member-drawer-body .create-group-selected-chip {
  flex-direction: column;
  gap: 6px;
  width: 64px;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.add-member-drawer-body .create-group-selected-chip:hover {
  background: transparent;
}

.add-member-drawer-body .create-group-selected-avatar-shell {
  position: relative;
  width: 46px;
  height: 46px;
}

.add-member-drawer-body .create-group-selected-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
}

.add-member-drawer-body .create-group-selected-name {
  width: 100%;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.2;
}

.add-member-drawer-body .create-group-selected-remove {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ff5b5b;
  color: #fff;
  font-size: 0.82rem;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg);
}

.add-member-contact-list {
  min-height: 260px;
}

.group-settings-helper-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.group-settings-helper-text.ready {
  color: var(--accent);
}

.group-settings-helper-text.error {
  color: var(--danger);
}

.group-settings-contact-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  min-height: 200px;
}

.group-settings-contact-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.group-settings-contact-item:last-child {
  border-bottom: none;
}

.group-settings-contact-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.group-settings-contact-item.selected {
  background: var(--accent-soft);
}

.group-settings-contact-item.selected .group-settings-contact-name {
  color: var(--accent);
}

.group-settings-contact-info {
  flex: 1;
  min-width: 0;
}

.group-settings-contact-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-settings-contact-aid {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-settings-check {
  color: var(--accent);
  font-weight: bold;
}

.add-member-drawer-footer {
  padding: 16px 24px 22px;
  background: var(--bg);
}

.group-settings-row.destructive .group-settings-row-label {
  color: var(--danger);
}

.group-settings-row:disabled {
  opacity: 1;
}

.group-settings-row.toggle {
  cursor: default;
}

.group-settings-row-label {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.group-settings-row-tail {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}

.group-settings-row-value {
  color: var(--text-dim);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-settings-inline-feedback {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
}

.group-settings-switch {
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 26px;
}

.group-settings-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.group-settings-switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s ease;
  position: relative;
}

.group-settings-switch-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
  transition: transform 0.2s ease;
}

.group-settings-switch input:checked + .group-settings-switch-track {
  background: var(--accent);
}

.group-settings-switch input:checked + .group-settings-switch-track::after {
  transform: translateX(20px);
}

.group-settings-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.92rem;
  text-align: center;
}

.group-settings-empty.compact {
  min-height: 112px;
  padding: 16px;
}

.group-settings-member-row,
.group-settings-transfer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.group-settings-member-row:last-child,
.group-settings-transfer-item:last-child {
  border-bottom: none;
}

.group-settings-member-main,
.group-settings-transfer-item {
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.group-settings-member-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.group-settings-member-row:hover,
.group-settings-transfer-item:hover {
  background: var(--accent-soft);
}

.group-settings-member-avatar,
.group-settings-profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
}

.group-settings-profile-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 24px 30px;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.38) 0, rgba(255, 255, 255, 0.14) 24%, transparent 25%),
    radial-gradient(circle at 84% 14%, rgba(255, 255, 255, 0.28) 0, rgba(255, 255, 255, 0.1) 18%, transparent 19%),
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent) 24%, white 76%) 0%,
      color-mix(in srgb, var(--accent) 14%, white 86%) 46%,
      rgba(255, 255, 255, 0.98) 100%
    );
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, white 18%);
}

.group-settings-profile-hero::before,
.group-settings-profile-hero::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  z-index: -1;
  pointer-events: none;
}

.group-settings-profile-hero::before {
  width: 180px;
  height: 180px;
  top: -88px;
  left: -60px;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 26%, white 74%) 0%,
    color-mix(in srgb, var(--accent) 12%, white 88%) 42%,
    transparent 72%
  );
}

.group-settings-profile-hero::after {
  width: 210px;
  height: 210px;
  right: -90px;
  bottom: -126px;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 18%, white 82%) 0%,
    color-mix(in srgb, var(--accent) 8%, white 92%) 46%,
    transparent 74%
  );
}

.group-settings-profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.86),
    0 16px 32px rgba(107, 114, 128, 0.18);
}

.group-settings-profile-name {
  font-size: 1.34rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.group-settings-profile-aid {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

.aid-profile-aid-copy {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 10px;
  color: var(--text-dim);
}

.aid-profile-aid-copy svg {
  width: 18px;
  height: 18px;
}

.aid-profile-aid-copy:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.aid-profile-aid-copy:active {
  transform: scale(0.96);
}

.group-settings-profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.group-settings-profile-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(148, 163, 184, 0.26);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.group-settings-profile-pill.generated {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 20%, transparent);
}

.group-settings-profile-pill.remote {
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 16%, transparent);
}

.group-settings-profile-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 18px 24px;
  background:
    linear-gradient(180deg, rgba(245, 247, 251, 0.92) 0%, rgba(255, 255, 255, 0.98) 140px, var(--bg-strong) 100%);
}

.aid-profile-content .group-settings-section {
  margin-bottom: 0;
}

.self-profile-content .group-settings-section {
  margin-top: 0;
}

.self-profile-content {
  display: block;
  min-height: 0;
}

.self-profile-hero {
  flex-shrink: 0;
  gap: 14px;
  padding-top: 30px;
  padding-bottom: 28px;
}

.self-profile-content .group-settings-section {
  flex-shrink: 0;
}

.self-profile-avatar-wrap {
  position: relative;
  padding: 0 6px 10px 0;
}

.self-profile-avatar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.self-profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  box-shadow: none;
}

.self-profile-avatar-trigger {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg-strong);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  pointer-events: none;
}

.self-profile-avatar-button:hover .self-profile-avatar-trigger,
.self-profile-avatar-button:focus-visible .self-profile-avatar-trigger {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-strong));
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line-strong));
}

.self-profile-avatar-button:focus-visible {
  outline: none;
}

.self-profile-avatar-button:focus-visible .self-profile-avatar {
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.86),
    0 0 0 10px color-mix(in srgb, var(--accent) 18%, transparent),
    0 16px 32px rgba(107, 114, 128, 0.18);
}

.self-profile-avatar-input {
  display: none;
}

.self-profile-form {
  padding-bottom: 18px;
}

.self-profile-form > .field:first-child,
.self-profile-form > .group-settings-inline-error + .field {
  margin-top: 8px;
}

.self-profile-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.self-profile-field-header > span {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
}

.self-profile-field-header .group-settings-counter {
  flex-shrink: 0;
}

.self-profile-signature-input {
  min-height: 120px;
}

.self-profile-policy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.self-profile-policy-option {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.self-profile-policy-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.self-profile-policy-copy strong {
  color: var(--text);
  font-size: 0.95rem;
}

.self-profile-policy-copy span {
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.5;
}

.self-profile-footer {
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  padding: 14px 0 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-strong) 64%, transparent), var(--bg-strong) 48%);
  backdrop-filter: blur(14px);
}

.self-profile-actions {
  margin-top: 0;
  gap: 12px;
  justify-content: flex-end;
}

.self-profile-actions .btn {
  min-width: 112px;
}

.aid-profile-sheet-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 108px 16px 16px;
}

.aid-profile-sheet {
  width: min(420px, 100%);
  padding: 14px 16px 16px;
  border-radius: 20px;
  background: var(--bg-strong);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
  animation: floatInSheet 0.18s ease-out;
  pointer-events: auto;
}

@keyframes floatInSheet {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aid-profile-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-dim) 35%, transparent);
  margin: 0 auto 16px;
}

.aid-profile-sheet-title {
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text);
}

.aid-profile-sheet-subtitle {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.aid-profile-sheet-field {
  margin-top: 16px;
}

.aid-profile-sheet-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.96rem;
  outline: none;
}

.aid-profile-sheet-field input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, white 45%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.aid-profile-sheet-counter {
  margin-top: 10px;
  text-align: right;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.aid-profile-sheet-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.group-settings-profile-summary {
  margin: 0 16px;
  color: var(--text-soft);
  line-height: 1.6;
  text-align: center;
  font-size: 0.95rem;
}

.group-settings-profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.group-settings-profile-tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.group-settings-profile-tag.human {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(124, 92, 255, 0.05));
  border-color: rgba(124, 92, 255, 0.22);
  color: #6b4ef6;
}

.group-settings-profile-tag.acp {
  background: linear-gradient(135deg, rgba(29, 205, 159, 0.16), rgba(29, 205, 159, 0.07));
  border-color: rgba(29, 205, 159, 0.24);
  color: #02b58a;
}

.group-settings-profile-tag.agent {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(59, 130, 246, 0.06));
  border-color: rgba(59, 130, 246, 0.24);
  color: #2a72e5;
}

.group-settings-profile-tag.developer {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.16), rgba(251, 146, 60, 0.06));
  border-color: rgba(251, 146, 60, 0.24);
  color: #df7a18;
}

.group-settings-profile-tag.default {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.06));
  border-color: rgba(148, 163, 184, 0.24);
  color: #64748b;
}

.group-settings-profile-card {
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 22px;
  border: none;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.group-settings-profile-list {
  margin: 0;
  padding: 0 0 0 20px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}

.group-settings-profile-list li {
  list-style-type: disc;
}

.group-settings-profile-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.group-settings-profile-quote {
  padding: 12px 14px;
  border-left: 4px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text-soft);
  line-height: 1.7;
}

.group-settings-profile-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.group-settings-profile-text {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
  line-height: 1.8;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.aid-profile-raw-panel {
  padding: 18px;
  background: var(--bg-strong);
}

.aid-profile-raw-text {
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  font: 0.82rem/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

.group-settings-profile-kv-list {
  display: grid;
  gap: 10px;
}

.group-settings-profile-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text-soft);
}

.group-settings-profile-kv span {
  color: var(--text-dim);
  font-size: 0.86rem;
}

.group-settings-profile-kv strong {
  color: var(--text);
  font-size: 0.9rem;
}

.group-settings-member-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-settings-member-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.group-settings-member-title > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-settings-member-subtitle {
  color: var(--text-dim);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-settings-role-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.group-settings-role-tag.owner {
  background: rgba(249, 115, 22, 0.12);
  color: #ea580c;
}

.group-settings-role-tag.admin {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.group-settings-role-tag.member {
  background: rgba(148, 163, 184, 0.12);
  color: #64748b;
}

.group-settings-dialog {
  max-width: 460px;
}

.group-settings-dialog.wide {
  max-width: 520px;
}

.group-settings-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.group-settings-dialog-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.group-settings-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-settings-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.group-settings-confirm-actions .btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 112px;
  white-space: nowrap;
}

.group-settings-members-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 12px;
}

.group-settings-members-toolbar .btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.group-settings-dialog-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-settings-dialog-separator {
  height: 1px;
  background: var(--line);
  margin: 0 4px;
}

.group-settings-choice {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.94rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.group-settings-choice:hover {
  border-color: var(--accent);
  background: var(--bg-soft);
}

.group-settings-choice.selected {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.group-settings-choice.danger {
  color: var(--danger);
}

.group-settings-check {
  color: var(--accent);
  font-weight: 700;
}

.group-settings-input,
.group-settings-textarea,
.group-settings-editor {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
  resize: vertical;
}

.group-settings-input:focus,
.group-settings-textarea:focus,
.group-settings-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.group-settings-textarea,
.group-settings-editor {
  min-height: 140px;
}

.group-settings-counter {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.group-settings-confirm-text {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.55;
}

.group-settings-editor {
  min-height: 168px;
  max-height: min(40vh, 320px);
  flex: 0 0 auto;
}

.group-settings-editor-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.group-settings-editor-footer-meta {
  min-width: 0;
  flex: 1;
}

.group-settings-editor-footer-meta .group-settings-counter {
  text-align: right;
  margin-bottom: 10px;
}

.group-settings-sticky-actions {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.group-settings-announcement-content {
  padding: 16px 20px;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.94rem;
}

.group-settings-announcement-meta {
  color: var(--text-dim);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.group-settings-request-item,
.group-settings-invite-item {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.group-settings-request-item:last-child,
.group-settings-invite-item:last-child {
  border-bottom: none;
}

.group-settings-request-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.group-settings-request-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.group-settings-request-info {
  min-width: 0;
  flex: 1;
}

.group-settings-request-title {
  font-size: 0.94rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-settings-request-reason {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.group-settings-request-meta,
.group-settings-invite-meta {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.group-settings-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.group-settings-invite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-settings-invite-code {
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.group-settings-markdown-preview {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-soft);
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.7;
  color: var(--text-soft);
}

@media (max-width: 900px) {
  .group-settings-drawer {
    width: 100%;
    max-width: 100%;
  }

  .group-settings-side-drawer {
    width: 100%;
    max-width: 100%;
  }

  .group-settings-content {
    padding: 16px;
  }

  .group-settings-editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .group-settings-editor-footer-meta .group-settings-counter {
    text-align: left;
  }

  .group-settings-dialog-actions {
    flex-direction: column;
  }

  .group-settings-dialog-actions .btn-action {
    width: 100%;
    justify-content: center;
  }

  .app-toast-region {
    left: 16px;
    right: 16px;
    top: 16px;
    width: auto;
  }

  .app-toast {
    padding: 13px 13px 13px 11px;
  }

  .group-approval-banner {
    margin: 12px 16px 0;
    padding: 13px 14px;
    align-items: flex-start;
  }

  .group-approval-banner-action {
    margin-top: 2px;
  }
}

.conversation-welcome {
  flex: 1;
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.conversation-welcome-avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.34), transparent 30%),
    linear-gradient(135deg, var(--avatar-start, var(--accent-gradient-start)) 0%, var(--avatar-end, var(--accent-gradient-end)) 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.conversation-welcome-avatar.group {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.3), transparent 30%),
    linear-gradient(135deg, var(--avatar-start, var(--accent-gradient-start)) 0%, var(--avatar-end, var(--accent-gradient-end)) 100%);
}

.conversation-welcome p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text-dim);
}

.chat-header-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header-title-row h2 {
  flex: 0 1 auto;
  min-width: 0;
}

.chat-header-count {
  margin-left: 4px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--text-dim);
}

.chat-header-sub {
  font-size: 0.84rem;
  color: var(--text-dim);
}

.messages-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  background: transparent;
  scrollbar-color: transparent transparent;
}

.messages-scroll:hover {
  scrollbar-color: rgba(128, 128, 128, 0.2) transparent;
}

.messages-scroll::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.messages-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.2);
}

.messages-scroll:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.4);
}

.chat-thread-region {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.topic-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.topic-panel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 40;
}

.topic-panel-overlay.desktop {
  background: transparent;
}

.topic-panel-drawer {
  pointer-events: auto;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  box-shadow: -4px 0 24px var(--shadow);
  transform: translateX(100%);
  animation: slideInRight 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.topic-panel-sheet {
  position: relative;
  width: min(720px, calc(100vw - 16px));
  max-height: min(78vh, 760px);
}

.topic-panel-header,
.topic-panel-footer {
  display: flex;
  align-items: center;
}

.topic-panel-header {
  justify-content: space-between;
  height: 72px;
}

.topic-panel-close {
  color: var(--text-dim);
}

.topic-panel-grabber {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
}

.topic-panel-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.topic-panel-section {
  margin: 12px 20px 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.topic-panel-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 73px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 14px 20px;
}

.topic-panel-row:last-child {
  border-bottom: none;
}

.topic-panel-row:hover {
  background: var(--accent-soft);
}

.topic-panel-row-action {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
}

.topic-panel-row.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.topic-panel-row-main {
  background: transparent;
}

.topic-panel-main {
  flex: 1;
  min-width: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.topic-panel-leading {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

.topic-panel-copy {
  flex: 1;
}

.topic-panel-title-row {
  min-width: 0;
}

.topic-panel-leading.main {
  font-size: 13px;
}

.topic-panel-title {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.topic-panel-meta {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.topic-panel-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topic-panel-badge.muted {
  background: color-mix(in srgb, var(--text-dim) 12%, transparent);
  color: var(--text-dim);
}

.topic-panel-input {
  min-height: 0;
  padding: 10px 12px;
}

.topic-panel-footer {
  gap: 12px;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.topic-panel-footer .group-settings-empty.compact {
  min-height: 0;
  width: 100%;
  padding: 10px;
}

.topic-panel-create {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-gradient-start), var(--accent-gradient-end));
  color: #fff;
  font-weight: 700;
}

.topic-panel-dialog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, #000 18%, transparent);
}

.topic-panel-menu {
  position: absolute;
  top: 76px;
  right: 12px;
  width: min(220px, calc(100vw - 48px));
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-strong);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 46;
  animation: popoverIn 0.15s ease;
  backdrop-filter: blur(20px);
}

.topic-panel-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.topic-panel-menu button:hover {
  background: var(--accent);
  color: #ffffff;
}

.topic-panel-menu-separator {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.topic-panel-menu button.danger {
  color: var(--danger);
}

.topic-panel-menu button.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.topic-panel-dialog {
  width: min(340px, calc(100vw - 40px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.topic-panel-dialog-title {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.topic-panel-dialog-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.topic-panel-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 760px) {
  .chat-header-title-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .topic-pill {
    max-width: 220px;
  }

  .topic-panel-drawer {
    display: none;
  }

  .topic-panel-overlay {
    position: fixed;
  }
}

.composer-error {
  padding: 10px 24px 0;
  color: var(--danger);
  font-size: 0.9rem;
  line-height: 1.5;
}

.action-notice {
  margin: 0 20px 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
}

.action-notice.success {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.action-notice.error {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.composer-state {
  padding: 0 4px 10px;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.5;
}

.composer-reply-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent);
}

.composer-reply-content {
  min-width: 0;
}

.composer-reply-title {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

.composer-reply-content .quote-preview {
  margin-top: 4px;
}

.composer-reply-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.composer-reply-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.new-message-indicator {
  position: absolute;
  right: 24px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--bg-strong);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 12px var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}

.new-message-indicator:hover {
  background: var(--accent);
  color: #ffffff;
}

.history-message-indicator {
  position: absolute;
  top: 16px;
  right: 24px;
  z-index: 2;
  display: flex;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 999px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--bg-strong) 88%, var(--accent) 12%);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background-color 0.2s;
}

.history-message-indicator:hover {
  background: color-mix(in srgb, var(--bg-strong) 82%, var(--accent) 18%);
}

.new-message-indicator-icon {
  flex-shrink: 0;
  margin-right: 6px;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-wrapper.mine {
  align-items: flex-end;
}

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

.message-select-toggle {
  width: 24px;
  height: 24px;
  margin-top: 8px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.message-select-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.message-select-toggle.is-selected {
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.message-select-toggle-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: transparent;
}

.message-select-toggle.is-selected .message-select-toggle-dot {
  background: var(--accent);
}

@keyframes targetMessagePulse {
  0% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
  }
  18% {
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
  }
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

.message-time-row {
  display: flex;
  justify-content: center;
  width: 100%;
  align-self: stretch;
  padding: 8px 0;
}

.message-time-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 8px;
  transition: all 120ms ease;
  user-select: none;
  appearance: none;
}

.message-time-pill:hover,
.message-time-pill:focus-visible {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.08);
}

.message-time-pill:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 80%, white 20%);
  outline-offset: 2px;
}

.message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message-wrapper.mine .message-row {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  flex-shrink: 0;
}

.message-body {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  /* Keep desktop bubbles close to WeChat: short text shrinks to content, long text caps well before full row width. */
  max-width: min(72%, 46rem);
  min-width: 0;
}

.message-wrapper.mine .message-body {
  flex-direction: row-reverse;
}

.message-bubble {
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 4px;
  padding-left: 2px;
}

.message-content {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.55;
  max-width: 100%;
  min-width: 44px;
  word-break: normal;
  overflow-wrap: break-word;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}



.message-wrapper.mine .message-content {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.message-content.is-media {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: fit-content;
}

.message-content.is-file-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: fit-content;
  min-width: min(240px, 100%);
  max-width: min(100%, 420px);
}

.message-content.is-sticker {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: fit-content;
}

.message-content.is-textual {
  width: max-content;
}

.message-content.is-markdown {
  width: max-content;
}

.message-wrapper.is-target-highlight .message-content:not(.is-media):not(.is-sticker):not(.is-file-card) {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 10px 24px color-mix(in srgb, var(--accent) 12%, transparent);
  animation: targetMessagePulse 1.15s ease-out 2;
}

.message-wrapper.is-target-highlight .image-card img,
.message-wrapper.is-target-highlight .file-card {
  animation: targetMessagePulse 1.15s ease-out 2;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 26%, transparent),
    0 10px 24px color-mix(in srgb, var(--accent) 12%, transparent);
}

.message-text {
  white-space: pre-wrap;
}

.message-markdown {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.message-markdown > :first-child {
  margin-top: 0;
}

.message-markdown > :last-child {
  margin-bottom: 0;
}

.message-markdown p,
.message-markdown ul,
.message-markdown ol,
.message-markdown blockquote,
.message-markdown table,
.message-markdown pre,
.message-markdown hr {
  margin: 0;
}

.message-markdown h1,
.message-markdown h2,
.message-markdown h3,
.message-markdown h4,
.message-markdown h5,
.message-markdown h6 {
  margin: 0;
  line-height: 1.35;
  font-weight: 700;
}

.message-markdown h1 { font-size: 1.12rem; }
.message-markdown h2 { font-size: 1.06rem; }
.message-markdown h3 { font-size: 1rem; }
.message-markdown h4 { font-size: 0.96rem; }
.message-markdown h5 { font-size: 0.92rem; }
.message-markdown h6 { font-size: 0.88rem; }

.message-markdown p {
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-markdown strong {
  font-weight: 700;
}

.message-markdown em {
  font-style: italic;
}

.message-markdown del {
  opacity: 0.8;
}

.message-markdown code {
  padding: 0.1rem 0.28rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--bg-strong) 72%, transparent);
  color: #d63384;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 0.92em;
}

.message-markdown a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-markdown ul,
.message-markdown ol {
  padding-inline-start: 1.35rem;
}

.message-markdown li + li {
  margin-top: 0.15rem;
}

.message-markdown blockquote {
  padding: 0.35rem 0.8rem;
  border-inline-start: 3px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: color-mix(in srgb, var(--bg-strong) 62%, transparent);
  border-radius: 0 6px 6px 0;
  color: var(--text-dim);
}

.message-markdown blockquote p + p {
  margin-top: 0.35rem;
}

.message-markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.message-markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.message-markdown th,
.message-markdown td {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.message-markdown th {
  background: color-mix(in srgb, var(--bg-strong) 70%, transparent);
}

.message-markdown hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.message-markdown-codeblock {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #333333;
}

.message-markdown-codeblock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 6px 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  background: #f1f3f5;
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  letter-spacing: 0.02em;
}

.message-markdown-codeblock-language {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 0 7px;
  border-radius: 4px;
  background: rgba(107, 114, 128, 0.12);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
}

.message-markdown-codeblock-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.message-markdown-codeblock-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.message-markdown-codeblock-action:hover {
  color: var(--text);
}

.message-markdown-codeblock-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-markdown-codeblock.is-collapsed .message-markdown-codeblock-header {
  border-bottom: 0;
}

.message-markdown-codeblock pre {
  margin: 0;
  padding: 0.65rem 0.75rem;
  overflow-x: auto;
  background: #f8fafc;
  color: #333333;
}

.message-markdown-codeblock code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #333333;
  font-size: 0.88rem;
  white-space: pre;
}

.message-markdown-codeblock .hljs {
  color: #333333;
  background: #f8fafc;
}

.message-markdown-codeblock .hljs-comment,
.message-markdown-codeblock .hljs-quote {
  color: #999988;
  font-style: italic;
}

.message-markdown-codeblock .hljs-keyword,
.message-markdown-codeblock .hljs-selector-tag {
  color: #333333;
  font-weight: 700;
}

.message-markdown-codeblock .hljs-subst {
  color: #333333;
  font-weight: 400;
}

.message-markdown-codeblock .hljs-number,
.message-markdown-codeblock .hljs-literal,
.message-markdown-codeblock .hljs-variable,
.message-markdown-codeblock .hljs-template-variable {
  color: #008080;
}

.message-markdown-codeblock .hljs-string,
.message-markdown-codeblock .hljs-doctag {
  color: #dd1144;
}

.message-markdown-codeblock .hljs-title,
.message-markdown-codeblock .hljs-section,
.message-markdown-codeblock .hljs-selector-id {
  color: #990000;
  font-weight: 700;
}

.message-markdown-codeblock .hljs-title.function_,
.message-markdown-codeblock .hljs-function .hljs-title {
  color: #990000;
  font-weight: 700;
}

.message-markdown-codeblock .hljs-params {
  color: #333333;
}

.message-markdown-codeblock .hljs-type {
  color: #445588;
  font-weight: 700;
}

.message-markdown-codeblock .hljs-tag,
.message-markdown-codeblock .hljs-name,
.message-markdown-codeblock .hljs-attribute,
.message-markdown-codeblock .hljs-attr,
.message-markdown-codeblock .hljs-property {
  color: #000080;
  font-weight: 400;
}

.message-markdown-codeblock .hljs-regexp,
.message-markdown-codeblock .hljs-link {
  color: #009926;
}

.message-markdown-codeblock .hljs-symbol,
.message-markdown-codeblock .hljs-bullet {
  color: #990073;
}

.message-markdown-codeblock .hljs-built_in,
.message-markdown-codeblock .hljs-builtin-name {
  color: #0086b3;
}

.message-markdown-codeblock .hljs-meta {
  color: #999999;
  font-weight: 700;
}

.message-markdown-codeblock .hljs-deletion {
  background: #ffdddd;
}

.message-markdown-codeblock .hljs-addition {
  background: #ddffdd;
}

.message-markdown-codeblock .hljs-emphasis {
  font-style: italic;
}

.message-markdown-codeblock .hljs-strong {
  font-weight: 700;
}

.message-markdown-image {
  display: inline-block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.message-mention {
  color: var(--accent);
  font-weight: 700;
}

.message-wrapper.mine .message-mention {
  color: inherit;
}

.message-quote {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  margin: 6px 0 0;
  padding: 4px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.16s ease;
  box-sizing: border-box;
}

.message-quote:hover {
  background: rgba(0, 0, 0, 0.04);
}

.message-quote:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white 30%);
  outline-offset: 2px;
}

.message-wrapper.mine .message-quote {
  justify-content: flex-end;
}

.message-wrapper.mine .message-quote:hover {
  background: rgba(0, 0, 0, 0.05);
}

.quote-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
}

.message-quote .quote-preview-bubble {
  padding-inline-start: 8px;
  padding-inline-end: 8px;
  border-inline-start: 2px solid color-mix(in srgb, var(--line) 78%, transparent);
}

.message-wrapper.mine .message-quote .quote-preview-bubble {
  border-inline-start: 0;
  border-inline-end: 2px solid color-mix(in srgb, var(--line) 78%, transparent);
}

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

.quote-preview-line {
  display: -webkit-box;
  min-width: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}

.quote-preview-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

.quote-preview-text {
  font-size: 0.73rem;
  color: var(--text-dim);
  white-space: inherit;
}

.quote-preview-thumb {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-strong);
}

.quote-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.quote-preview-thumb-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.quote-preview-thumb-fallback svg {
  width: 18px;
  height: 18px;
}

.quote-preview-file-icon {
  flex-shrink: 0;
}

.file-icon.quote-preview-file-icon {
  width: 36px;
  height: 36px;
}

.file-icon.quote-preview-file-icon svg {
  width: 20px;
  height: 20px;
}

.quote-preview-composer {
  padding: 0;
  border: 0;
  background: transparent;
}

.quote-preview-composer .quote-preview-text {
  white-space: nowrap;
}

.quote-preview-detail {
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 82%, var(--bg));
}

.quote-preview-detail .quote-preview-text {
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.message-quote-tooltip {
  position: fixed;
  z-index: 2100;
  width: max-content;
  max-width: min(330px, calc(100vw - 20px));
  min-width: 190px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, rgba(255, 255, 255, 0.22));
  background: color-mix(in srgb, var(--bg-strong) 92%, white 8%);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.24),
    0 2px 8px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
  will-change: left, top;
}

.message-quote-tooltip::before,
.message-quote-tooltip::after {
  content: "";
  position: absolute;
  left: var(--quote-tooltip-arrow-left, 24px);
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
}

.message-quote-tooltip.is-above::before {
  bottom: -9px;
  border-top: 9px solid color-mix(in srgb, var(--line) 72%, rgba(255, 255, 255, 0.22));
}

.message-quote-tooltip.is-above::after {
  bottom: -7px;
  border-top: 8px solid color-mix(in srgb, var(--bg-strong) 92%, white 8%);
}

.message-quote-tooltip.is-below::before {
  top: -9px;
  border-bottom: 9px solid color-mix(in srgb, var(--line) 72%, rgba(255, 255, 255, 0.22));
}

.message-quote-tooltip.is-below::after {
  top: -7px;
  border-bottom: 8px solid color-mix(in srgb, var(--bg-strong) 92%, white 8%);
}

.message-quote-tooltip .quote-preview {
  color: var(--text-soft);
}

.message-quote-tooltip .quote-preview-detail {
  padding: 0;
  border: 0;
  background: transparent;
}

.message-quote-tooltip .quote-preview-sender {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.message-quote-tooltip .quote-preview-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
}

.message-type-pill {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.message-content.is-semantic {
  background: rgba(255, 255, 255, 0.03);
}

.message-content.is-recalled {
  border-style: dashed;
  color: var(--text-dim);
  font-style: italic;
}

.message-read-receipt {
  margin-top: 4px;
  align-self: flex-end;
  font-size: 0.72rem;
  color: color-mix(in srgb, var(--accent) 72%, transparent);
}

.message-read-receipt.is-group {
  margin-top: 6px;
  font-size: 0.74rem;
  color: color-mix(in srgb, var(--accent) 78%, var(--text-dim) 22%);
}

.message-action-shell {
  flex-shrink: 0;
}

.message-action-button {
  display: none;
}

.message-action-menu {
  position: fixed;
  z-index: 2000;
  min-width: 140px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-strong);
  box-shadow: 0 4px 24px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto;
  will-change: left, top;
}

.message-action-menu-item {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.message-action-menu-item:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.message-action-menu-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.message-action-menu-item:hover .message-action-menu-icon {
  opacity: 1;
}

.message-action-menu-icon svg {
  width: 18px;
  height: 18px;
}

.message-action-menu-label {
  line-height: 1.2;
}

.message-action-menu-item.is-favorite {
  color: var(--warning);
}

.message-action-menu-item.danger {
  color: var(--danger);
}

.message-action-menu-item.danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.message-action-menu-separator {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.message-action-menu-item.is-disabled,
.message-action-menu-item:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.5;
}

.message-action-menu-item.is-disabled:hover,
.message-action-menu-item:disabled:hover {
  background: transparent;
  color: var(--text-dim);
}

.message-send-error {
  width: 18px;
  height: 18px;
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 6px;
}

.message-send-error svg {
  width: 18px;
  height: 18px;
}

.message-batch-toolbar {
  margin: 0 20px 20px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(11, 16, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-selection-cancel {
  min-width: 76px;
}

.message-wrapper.mine .message-bubble {
  align-items: flex-end;
}

.message-meta-row {
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.message-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.image-card {
  display: block;
  padding: 0;
  border: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  box-shadow: none !important;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
  max-width: min(400px, 100%);
}

.image-card img {
  display: block;
  max-width: min(400px, 100%);
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.image-card.has-preview-size img {
  width: 100%;
  height: 100%;
}

.image-card.is-sticker {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 18px;
  max-width: min(60px, 100%);
}

.image-card.is-sticker img {
  max-width: min(60px, 100%);
  max-height: 60px;
  border-radius: 4px;
  filter: none;
}

.image-meta,
.file-meta,
.composer-hint {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.file-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  width: 100%;
  cursor: pointer;
  transition: all 120ms ease;
  color: var(--text);
}

.file-card:hover {
  background: color-mix(in srgb, var(--bg-soft) 88%, var(--accent) 12%);
}

.file-card:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 36%, transparent);
}

@media (max-width: 640px) {
  .message-content.is-file-card {
    width: min(100%, 300px);
    min-width: 0;
  }
}

.file-card-copy {
  min-width: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-card-title {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  flex-shrink: 0;
}

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

.composer {
  flex-shrink: 0;
  padding: 12px 20px 20px;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.composer.is-readonly {
  justify-content: center;
}

.composer-readonly-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 48px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-soft) 90%, #fff 10%);
}

.composer-readonly-message {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

.composer-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.composer-action-btn {
  background: transparent;
  padding: 6px;
  color: var(--text-soft);
  border-radius: 6px;
  transition: all 120ms ease;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--line);
}

.composer-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.composer-input-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}

.composer-input-shell.is-drag-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-soft));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.composer-input-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 8px;
}

.composer-draft-area {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 8px 2px;
  min-height: 56px;
}

.composer-draft-area.has-items {
  min-height: 92px;
}

.composer-draft-text {
  align-self: flex-end;
  flex: 0 1 auto;
  max-width: min(100%, 420px);
  padding: 0 2px;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer-draft-caret {
  align-self: center;
  width: 1px;
  height: 76px;
  border-radius: 999px;
  background: var(--accent);
  animation: composer-caret-blink 1s steps(2, start) infinite;
}

@keyframes composer-caret-blink {
  50% {
    opacity: 0;
  }
}

.composer-draft-attachment {
  position: relative;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  overflow: hidden;
}

.composer-draft-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  background: #fff;
  cursor: zoom-in;
}

.composer-draft-image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: zoom-in;
}

.composer-draft-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 220px;
  max-width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-strong);
  cursor: pointer;
}

.composer-draft-file-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  order: 2;
}

.composer-draft-file-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-draft-file-name {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-draft-file-size {
  color: var(--text-dim);
  font-size: 0.74rem;
  line-height: 1.2;
}

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

.composer-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 120ms ease;
}

.composer-action-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

.composer-action-icon.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.composer textarea,
.composer-input {
  border: 0;
  background: transparent;
  caret-color: var(--accent);
  padding: 10px 12px;
  min-height: 44px;
  max-height: 180px;
  resize: none;
  font-size: 0.94rem;
  color: var(--text);
  line-height: 1.5;
}

.composer-draft-area .composer-input {
  align-self: flex-end;
  flex: 1 1 180px;
  width: 100%;
  min-width: 140px;
  padding: 4px;
}

.composer-draft-area.has-items .composer-input {
  min-height: calc(1.5em + 8px);
  padding: 0 4px 2px;
  overflow-y: hidden;
}

.composer-input.is-draft-cursor-active {
  caret-color: transparent;
}

.composer-sticker-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 12px;
  background: var(--bg-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  width: min(520px, 100%, calc(100vw - 32px));
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.composer-sticker-section {
  display: flex;
  flex-direction: column;
}

.composer-sticker-section-title {
  padding: 0 2px;
  color: var(--text-dim);
  font-size: 0.74rem;
  font-weight: 700;
}

.composer-sticker-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.composer-sticker-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: none;
  color: var(--text);
  min-width: 0;
  padding: 6px 2px;
}

.composer-sticker-item:hover {
  background: var(--bg-soft);
  transform: translateY(-1px);
}

.composer-sticker-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.composer-sticker-emoji {
  font-size: 1.55rem;
  line-height: 1;
}

.composer-sticker-label {
  display: none;
}

.composer-input:focus {
  outline: none;
  box-shadow: none;
}

.composer-mention-panel {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 92%, #fff 8%);
}

.composer-command-panel {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-soft) 92%, #fff 8%);
}

.composer-mention-header {
  padding: 10px 12px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
}

.composer-mention-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 6px 8px;
}

.composer-mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 8px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.composer-mention-item:hover,
.composer-mention-item.active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.composer-command-item:hover {
  background: transparent;
}

.composer-command-item.active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.composer-mention-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.composer-mention-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-command-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.composer-mention-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.composer-command-description {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-mention-aid {
  font-size: 0.74rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-mention-empty {
  padding: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.composer-send {
  min-width: 72px;
  min-height: 32px !important;
  padding: 0 14px;
  font-size: 0.85rem;
}

.draft-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
}

.draft-remove-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 120ms ease;
}

.draft-remove-btn:hover {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}

.composer-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

.log-panel {
  display: flex;
}

.log-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.log-filters {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-strong);
}

.log-filters .button-row {
  display: grid;
  grid-template-columns: 140px 140px minmax(200px, 1fr);
  gap: 12px;
}

.log-list {
  flex: 1;
  overflow: auto;
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-entry {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.log-entry.warn {
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  background: color-mix(in srgb, var(--warning) 5%, transparent);
}

.log-entry.error {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: color-mix(in srgb, var(--danger) 5%, transparent);
}

.log-entry pre,
.mono {
  margin: 8px 0 0;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.85);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.modal-surface {
  max-width: min(92vw, 1080px);
  max-height: min(88vh, 860px);
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.identity-modal {
  width: min(720px, 100%);
}

.modal-list {
  max-height: min(60vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 200ms ease;
}

.lightbox-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.lightbox-loading .spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox-image {
  cursor: zoom-in;
  transform-origin: center center;
  transition: transform 80ms ease-out;
  user-select: none;
  touch-action: none;
  will-change: transform;
}

.lightbox-image.is-draggable {
  cursor: grab;
}

.lightbox-image.is-dragging {
  cursor: grabbing;
  transition: none;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
  z-index: 1000;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: scale(1.05);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-top-color: #fff;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 300px;
  }

  .login-shell {
    width: min(420px, 100%);
  }

  .app-shell-layout {
    grid-template-columns: 72px minmax(260px, 300px) minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  :root {
    --sidebar-width: 292px;
    --rail-width: 58px;
  }

  .app-shell-layout {
    grid-template-columns: 1fr;
  }

  .app-nav {
    flex-direction: row;
    justify-content: space-between;
    min-height: auto;
  }

  .nav-pill,
  .nav-spacer {
    display: none;
  }

  .app-sidebar,
  .app-main,
  .log-panel {
    min-height: auto;
  }

  .sidebar-resize-handle {
    display: none;
  }

  .app-rail {
    padding-left: 7px;
    padding-right: 7px;
  }

  .rail-profile-button,
  .rail-item {
    width: 42px;
    height: 42px;
  }

  .log-panel {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .login-page,
  .app-shell-layout {
    padding: 12px;
  }

  .field-grid,
  .button-stack,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 24px 20px 24px;
    border-radius: 24px;
  }

  .login-input-shell {
    min-height: 62px;
    padding: 0 16px;
  }

  .login-code-action {
    min-width: 66px;
    font-size: 0.9rem;
  }

  .message-body {
    /* Mobile also reserves room for the avatar, gutter, and outer page padding. */
    max-width: min(80%, calc(100vw - 104px));
  }

  .login-create-settings-summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .login-create-settings-toggle {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .login-avatar-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .login-avatar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
