/* Direct messages and Home (client/js/dms.js) and User Settings > My Account (client/js/account.js).
   Uses the theme tokens from styles.css. */

/* ---- server rail: Home, and the avatars of DMs with unread messages ---- */
.guild-icon.home-button { color: var(--text); }
.guild-icon.home-button:hover, .guild-icon.home-button.active { background: var(--accent); color: #fff; }
.guild-icon.dm-rail-item { background: none; padding: 0; }
.guild-icon.dm-rail-item .avatar { width: 48px; height: 48px; font-size: 18px; transition: border-radius 0.15s; }
.guild-icon.dm-rail-item .avatar .avatar-img { transition: border-radius 0.15s; }
.guild-icon.dm-rail-item:hover .avatar, .guild-icon.dm-rail-item:hover .avatar .avatar-img { border-radius: 16px; }
.rail-badge { position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 3px var(--bg-rail); pointer-events: none; }

/* ---- Home's sidebar ---- */
.sidebar-header.home-header { padding: 0 10px; }
.dm-find { width: 100%; height: 28px; border: 0; border-radius: 4px; background: var(--bg-rail); color: var(--text-muted); font-size: 13px; font-weight: 500; text-align: left; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-find:hover { color: var(--text); }
.dm-empty { padding: 4px 8px; }
.channel.dm-row { position: relative; gap: 12px; padding: 6px 8px; cursor: pointer; }
.channel.dm-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dm-row .avatar .status { border-color: var(--bg-sidebar); }
.dm-row:hover .avatar .status { border-color: var(--bg-hover); }
.dm-row.active .avatar .status { border-color: var(--bg-active); }
.dm-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-row-name, .dm-row-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-row-badge { position: static; box-shadow: none; flex: none; }
.dm-close { display: none; flex: none; background: none; border: 0; padding: 2px; border-radius: 4px; color: var(--text-muted); }
.dm-close:hover { color: var(--text-strong); }
.dm-row:hover .dm-close, .dm-row:focus-within .dm-close, .dm-row.active .dm-close { display: inline-flex; }
.dm-row:hover .dm-row-badge { display: none; }

/* Find or start a conversation */
.dm-finder { width: 340px; max-height: 420px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-sidebar); border-radius: 8px; padding: 12px; }
.dm-finder .profile-section-title { margin: 0; }
.dm-finder-input { width: 100%; }
.dm-finder-results { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.dm-finder-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 4px; color: var(--text); }
.dm-finder-row:hover, .dm-finder-row:focus-visible { background: var(--bg-hover); outline: none; }
.dm-finder-row .avatar .status { border-color: var(--bg-sidebar); }
.dm-finder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-finder-empty { padding: 8px; }

/* ---- the open DM ---- */
.chat-header .avatar.dm-header-avatar { width: 24px; height: 24px; font-size: 12px; cursor: pointer; }
.chat-header .avatar.dm-header-avatar .status { width: 10px; height: 10px; border-width: 2px; border-color: var(--bg-chat); }
.chat-header .channel-title.dm::before { content: none; }
.dm-start .avatar.large { width: 80px; height: 80px; font-size: 32px; margin-bottom: 8px; }
.dm-start h2 { margin-bottom: 0; }
.dm-start-username { color: var(--text-strong); font-size: 18px; font-weight: 500; margin-bottom: 12px; }
.dm-profile .profile-card { width: 100%; }
.profile-card .profile-message { margin-top: 12px; width: 100%; }

/* ---- User Settings > My Account ---- */
.account-card { background: var(--bg-rail); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.account-value { color: var(--text-strong); margin-top: 2px; overflow-wrap: anywhere; }
.account-row button.secondary { padding: 6px 14px; }
.account-section { color: var(--text-strong); margin: 32px 0 12px; }
.account-form { max-width: 440px; }
.account-form h3 { margin: 0; color: var(--text-strong); }
.account-form p { margin: 0; }
