/* ===================== v3: avatars, quick actions, wizard, security ===================== */
.uchip { position: relative; overflow: hidden; }
.uchip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }
.uchip.lg { width: 40px; height: 40px; font-size: .95rem; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.fuser { display: flex; gap: 10px; align-items: center; min-width: 190px; }
.fuser a:first-child { border-radius: 50%; }
.qa { display: flex; gap: 3px; justify-content: flex-end; flex-wrap: nowrap; }
.qa .icon-btn { width: 30px; height: 30px; font-size: .98rem; }
.qa .icon-btn:hover { border-color: var(--violet); color: var(--violet); }
.fnote { padding: 4px 8px; min-width: 110px; font-size: .85rem; border-color: transparent; background: transparent; }
.fnote:hover, .fnote:focus { border-color: var(--line); background: var(--surface); }
.ftable tr:has(.sel:checked) { background: var(--violet-soft); }
.bulkbar { position: sticky; top: 70px; z-index: 5; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px;
  border-radius: var(--radius); background: var(--ink); color: #fff; }
.bulkbar .btn { background: transparent; color: #fff; border-color: #3A3C6E; }
@media (max-width: 720px) { .qa { flex-wrap: wrap; justify-content: flex-start; } }

/* Connection wizard */
.wizard { counter-reset: step; }
.wstep { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.wstep:last-child { border-bottom: 0; }
.wstep .wnum { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); }
.wstep.ok .wnum { background: var(--gain); color: #fff; border-color: var(--gain); }
.wstep.now .wnum { background: var(--violet); color: #fff; border-color: var(--violet); }
.wstep h3 { margin: 4px 0 6px; }
.wstep .wbody { color: var(--muted); font-size: .92rem; }
.wstep.ok h3::after { content: " ✓"; color: var(--gain); }
.copyline { display: flex; gap: 6px; margin: 8px 0; }
.copyline input { font-family: ui-monospace, monospace; font-size: .85rem; }

/* 2FA */
.otp-input { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: .5em; text-align: center; direction: ltr; }
.bulkbar[hidden] { display: none; }

/* Direct messages */
.dm-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.dm-list { padding: 8px; max-height: calc(100vh - 190px); overflow-y: auto; }
.dm-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; color: var(--text); text-decoration: none; }
.dm-item:hover { background: var(--surface-2); }
.dm-item.active { background: var(--violet-soft); }
.dm-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-item small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dm-meta em { font-style: normal; background: var(--violet); color: #fff; border-radius: 10px; font-size: .7rem; padding: 0 7px; }
.dm-chat { display: flex; flex-direction: column; min-height: calc(100vh - 190px); padding: 0; overflow: hidden; }
.dm-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dm-head .grow { flex: 1; min-width: 0; }
.dm-back { display: none; }
.dm-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 330px); background: var(--surface-2); }
.dm-day { align-self: center; font-size: .72rem; color: var(--muted); background: var(--surface); border-radius: 10px; padding: 2px 10px; margin: 6px 0; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 18px; font-size: .94rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble small { display: block; font-size: .66rem; opacity: .65; margin-top: 2px; }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-start-start-radius: 6px; }
.bubble.me { align-self: flex-end; background: var(--violet); color: #fff; border-start-end-radius: 6px; }
.dm-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--line); }
.dm-compose textarea { flex: 1; min-height: 42px; max-height: 140px; resize: none; }
.dm-compose select { width: 120px; }
@media (max-width: 900px) {
  .dm-layout { grid-template-columns: minmax(0, 1fr); }
  .dm-layout.has-thread .dm-list { display: none; }
  .dm-layout:not(.has-thread) .dm-chat { display: none; }
  .dm-back { display: inline-grid; }
  .dm-chat { min-height: calc(100dvh - 220px); }
  .dm-msgs { max-height: none; }
  .dm-compose select { display: none; }
}
body.m .dm-chat { border-radius: 18px; }
