:root[data-theme="light"] {
  --bg: #fff; --side: #f2f3f5; --card: #f6f6f8; --soft: #e9eaed; --hover: #e4e5e8; --active: #dcdde2;
  --fg: #22232a; --fg2: #555863; --muted: #686b77; --line: #dfe0e5; --line-strong: #c4c6cf;
  --brand: #ba0c2f; --brand-2: #a50929; --brand-soft: #fce8ed; --brand-line: #dba5b1; color-scheme: light;
}
:root[data-theme="midnight"] {
  --bg: #08090b; --side: #0d0e11; --card: #17181d; --soft: #121318; --hover: #202128; --active: #2a2b34;
}
.rail { background: var(--side); }
.dm-find { background: var(--soft); color: var(--fg2); }
.user-panel { background: var(--card); border-color: var(--line-strong); }
.user-profile:hover, .audio-options:hover { background: var(--hover); }
.user-settings { position: fixed; inset: 0; z-index: 35; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 900px) minmax(72px, 1fr); background: var(--bg); color: var(--fg); }
.settings-nav { background: var(--side); border-right: 1px solid var(--line); overflow-y: auto; padding: 50px 12px 32px max(16px, calc(100% - 224px)); }
.settings-nav .settings-person { display: flex; align-items: center; gap: 10px; padding: 12px 10px 22px; }
.settings-person b, .settings-person small { display: block; }
.settings-person small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.settings-nav h3 { padding: 20px 10px 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.settings-nav button { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: 5px; color: var(--fg2); font-size: 14px; margin: 2px 0; }
.settings-nav button:hover { background: var(--hover); color: var(--fg); }
.settings-nav button[aria-current] { color: var(--fg); background: var(--active); font-weight: 600; }
.settings-nav button.settings-logout { margin-top: 26px; border-top: 1px solid var(--line); color: #d84c68; border-radius: 0; }
.settings-main { overflow-y: auto; padding: 60px 48px 80px; min-width: 0; }
.settings-main h1 { font-size: 24px; margin: 0 0 10px; letter-spacing: -.025em; }
.settings-main h2 { font-size: 17px; margin: 26px 0 16px; }
.settings-main h3 { font-size: 13px; }
.settings-intro { font-size: 14px; color: var(--fg2); line-height: 1.6; margin: 0 0 26px; }
.settings-close-wrap { padding: 60px 18px; }
.settings-close { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--muted); border-radius: 50%; color: var(--fg2); }
.settings-close:hover { background: var(--hover); color: var(--fg); }
.settings-close-wrap small { display: block; font-size: 10px; color: var(--muted); width: 36px; text-align: center; margin-top: 8px; }
.settings-card { background: var(--card); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.settings-banner { height: 90px; background: #ba0c2f; }
.settings-card-head { display: flex; align-items: center; gap: 14px; padding: 20px; }
.settings-card-head .av { border: 5px solid var(--card); margin-top: -50px; width: 82px; height: 82px; }
.settings-card-head b { font-size: 20px; }
.settings-card-head .btn { margin-left: auto; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-top: 1px solid var(--line); }
.settings-row small, .settings-label { display: block; font-size: 11px; color: var(--fg2); text-transform: uppercase; font-weight: 650; letter-spacing: .035em; margin-bottom: 7px; }
.settings-value { font-size: 14px; overflow-wrap: anywhere; }
.settings-row .btn { flex: none; }
.settings-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 28px; }
.settings-form .field { margin-bottom: 22px; }
.settings-form textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.settings-form small { display: block; color: var(--muted); font-size: 11px; margin-top: 7px; }
.profile-preview { align-self: start; }
.profile-preview .settings-card-head { display: block; }
.profile-preview .settings-card-head .av { margin-top: -58px; margin-bottom: 12px; }
.profile-preview .settings-card-head > .av { display: flex; }
.profile-preview .settings-card-head > b, .profile-preview .settings-card-head > small { display: block; overflow-wrap: anywhere; }
.profile-preview .settings-card-head > small { margin-top: 4px; }
.profile-preview .profile-details { padding: 0 20px 20px; }
.profile-preview .profile-bio { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; margin: 8px 0 20px; }
.profile-preview .profile-status { color: var(--fg2); font-size: 12px; margin: 6px 0 18px; }
.profile-preview .settings-label { padding-top: 14px; border-top: 1px solid var(--line); }
.profile-save { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px; border-radius: 7px; background: var(--soft); margin-top: 24px; }
.profile-save .saved-message { margin-right: auto; color: var(--fg2); font-size: 12px; }
.settings-main .avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.theme-choice { text-align: left; border: 2px solid var(--line); border-radius: 9px; padding: 0; overflow: hidden; }
.theme-choice[aria-checked="true"] { border-color: var(--brand); }
.theme-choice b { display: block; padding: 12px 14px; font-size: 13px; }
.theme-sample { height: 86px; display: flex; background: #1a1a1e; }
.theme-sample i { width: 25%; background: #121214; }
.theme-sample span { margin: 16px; width: 56%; height: 8px; background: #62626b; border-radius: 4px; box-shadow: 0 17px 0 #4a4a54, 0 34px 0 #3b3b44; }
.theme-light .theme-sample { background: #fff; }.theme-light .theme-sample i { background: #e9eaed; }
.theme-light .theme-sample span { background: #a9acb8; box-shadow: 0 17px 0 #c6c8d0, 0 34px 0 #dadce2; }
.theme-midnight .theme-sample { background: #08090b; }.theme-midnight .theme-sample i { background: #15161c; }
.settings-video { width: 100%; aspect-ratio: 16/9; max-height: 300px; object-fit: cover; border-radius: 8px; background: #09090b; margin: 14px 0; }
.settings-main .voice-controls { border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.settings-main .voice-controls > h2:first-child { margin-top: 0; }
.settings-main .voice-controls > h2 .icon-btn, .settings-main .voice-controls > .actions { display: none; }
.settings-connections { display: grid; gap: 12px; }
.connection-row { display: flex; align-items: center; gap: 14px; padding: 16px; }
.connection-row .grow { min-width: 0; }
.connection-row b { display: block; font-size: 14px; }
.connection-row small { font-size: 12px; color: var(--fg2); display: block; margin-top: 5px; }
.connection-row .btn { flex: none; }
@media (max-width: 1100px) {
  .user-settings { grid-template-columns: 210px minmax(0, 1fr) 60px; }
  .settings-nav { padding-left: 12px; }
  .settings-main { padding: 52px 28px; }
  .settings-close-wrap { padding-left: 8px; }
  .settings-form-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-preview { max-width: 360px; }
}
@media (max-width: 650px) {
  .user-settings { display: flex; flex-direction: column; }
  .settings-nav { flex: none; padding: 14px 52px 12px 12px; border: 0; border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
  .settings-nav .settings-person, .settings-nav h3 { display: none; }
  .settings-nav button { width: auto; display: inline-flex; font-size: 12px; min-height: 34px; margin: 0 4px 0 0; }
  .settings-nav button.settings-logout { margin: 0; border: 0; }
  .settings-main { flex: 1; padding: 26px 18px 56px; }
  .settings-close-wrap { position: absolute; top: 14px; right: 10px; padding: 0; background: var(--side); }
  .settings-close-wrap small { display: none; }
  .settings-close { width: 30px; height: 30px; }
  .settings-row { gap: 10px; padding: 16px; }
  .settings-card-head { flex-wrap: wrap; }
  .settings-card-head .btn { margin-left: 0; }
}

.workspace-intro { text-align: center; padding: 6px 12px 18px; }
.workspace-intro h2 { margin-bottom: 10px; }
.workspace-choice { display: flex; width: 100%; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line-strong); border-radius: 8px; text-align: left; margin-bottom: 12px; }
.workspace-choice:hover { background: var(--hover); }
.workspace-choice small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.workspace-join { margin-top: 24px; padding: 20px; background: var(--soft); border-radius: 8px; text-align: center; }
.workspace-join h3 { margin-bottom: 12px; }
.workspace-picture-field { display: grid; justify-items: center; gap: 8px; margin-bottom: 24px; }
.workspace-upload { display: grid; place-content: center; gap: 5px; justify-items: center; width: 92px; height: 92px; border-radius: 50%; border: 2px dashed var(--muted); overflow: hidden; }
.workspace-upload svg { width: 25px; height: 25px; }.workspace-upload small { font-size: 10px; font-weight: 700; }
.workspace-upload img { width: 92px; height: 92px; object-fit: cover; }
.workspace-options { border: 1px solid var(--line); padding: 14px; border-radius: 7px; margin-bottom: 16px; }
.workspace-options summary { cursor: pointer; font-size: 12px; color: var(--fg2); }
.workspace-options .field { margin-top: 16px; }
.workspace-invites { max-height: 240px; overflow-y: auto; margin-bottom: 20px; }

.profile-avatar { align-self: start; padding: 0; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.profile-avatar:hover { outline: 2px solid var(--brand); outline-offset: 2px; }.msg.cont .profile-avatar { visibility: hidden; }
.dialog > .profile-preview { width: 100%; max-width: 100%; }
