/* ============================================================
   Свой мессенджер — оформление в духе Telegram
   ============================================================ */

:root {
  --bg: #0e1621;
  --panel: #17212b;
  --panel-2: #1e2b38;
  --panel-3: #243443;
  --border: #24313d;
  --text: #e8eef5;
  --text-dim: #a6b5c2;
  --muted: #7d8e9c;
  --accent: #2a9bf0;
  --accent-strong: #1f8ad9;
  --danger: #e5484d;
  --success: #2fbf71;
  --bubble-in: #1e2b38;
  --bubble-out: #2b5278;
  --bubble-out-text: #ffffff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.light {
  --bg: #e9eff5;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --panel-3: #e4ecf4;
  --border: #dbe4ec;
  --text: #14212c;
  --text-dim: #4a5a68;
  --muted: #7b8b99;
  --bubble-in: #ffffff;
  --bubble-out: #2a9bf0;
  --bubble-out-text: #ffffff;
  --shadow: 0 18px 48px rgba(16, 38, 58, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }

.hidden { display: none !important; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon-xl { width: 34px; height: 34px; }

/* ------------------------------ вход ------------------------------ */

.auth {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% 0%, rgba(42, 155, 240, 0.22), transparent 60%),
    radial-gradient(900px 500px at 85% 100%, rgba(122, 92, 240, 0.18), transparent 60%),
    var(--bg);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: linear-gradient(140deg, #2a9bf0, #6a5cf0);
  box-shadow: 0 12px 28px rgba(42, 155, 240, 0.35);
}
.auth-logo-bubble {
  width: 32px;
  height: 32px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 25px;
  letter-spacing: -0.4px;
}

.auth-subtitle {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 14px;
}

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

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

.field > span {
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field textarea,
.readonly-value,
#message-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  resize: none;
}

.field input:focus,
.field textarea:focus,
#message-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 155, 240, 0.15);
}

.field input::placeholder,
.field textarea::placeholder,
#message-input::placeholder { color: var(--muted); }

.input-prefix { display: flex; align-items: center; gap: 0; position: relative; }
.input-prefix .prefix {
  position: absolute;
  left: 13px;
  color: var(--muted);
  pointer-events: none;
}
.input-prefix input { padding-left: 30px; }

.readonly-value {
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.985); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }

.btn-ghost {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--panel-3); }

.btn-danger-ghost {
  background: rgba(229, 72, 77, 0.1);
  color: var(--danger);
  border: 1px solid rgba(229, 72, 77, 0.35);
  width: 100%;
}

.link-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 6px;
  text-align: center;
}

.auth-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

/* --------------------------- основной экран --------------------------- */

.main {
  display: flex;
  height: 100dvh;
  width: 100%;
}

.sidebar {
  width: 370px;
  flex: 0 0 370px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  min-width: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  min-height: 58px;
}

.sidebar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  flex: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.search-bar .search-icon { color: var(--muted); width: 18px; height: 18px; }
#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 6px 0;
  min-width: 0;
}

.list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.chats-list { display: flex; flex-direction: column; }

.chat-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  text-align: left;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.12s ease;
  position: relative;
}
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--panel-3); }

.chat-item-body { flex: 1; min-width: 0; }

.chat-item-top { display: flex; align-items: baseline; gap: 8px; }
.chat-item-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chat-item-time { font-size: 11.5px; color: var(--muted); flex: none; }

.chat-item-bottom { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.chat-item-preview {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item.unread .chat-item-preview { color: var(--text); font-weight: 500; }

.badge {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* --------------------------- аватары --------------------------- */

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(140deg, #3c7fd0, #6a5cf0);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: visible;
  user-select: none;
}
.avatar-sm { width: 40px; height: 40px; font-size: 15px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; }

.avatar-btn { padding: 0; border-radius: 50%; }

.status-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--panel);
}

/* --------------------------- пустое состояние --------------------------- */

.chat-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(42, 155, 240, 0.08), transparent 70%),
    var(--bg);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  padding: 30px;
  text-align: center;
}
.empty-bubble {
  width: 86px;
  height: 86px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--accent);
  margin-bottom: 8px;
}
.empty-state h2 { margin: 0; color: var(--text); font-size: 19px; }
.empty-state p { margin: 0 0 12px; font-size: 14px; max-width: 320px; }

/* --------------------------- чат --------------------------- */

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  min-height: 58px;
}

.chat-peer { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.chat-peer-text { min-width: 0; }
.chat-peer-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-peer-status { font-size: 12.5px; color: var(--muted); }
.chat-peer-status.online { color: var(--accent); }

.back-btn { display: none; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.day-divider {
  align-self: center;
  margin: 10px 0;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(125, 142, 156, 0.18);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

.msg-row { display: flex; max-width: 100%; }
.msg-row.out { justify-content: flex-end; }
.msg-row.group-start { margin-top: 8px; }

.bubble {
  position: relative;
  max-width: min(560px, 78%);
  padding: 7px 11px 7px;
  border-radius: 13px;
  background: var(--bubble-in);
  color: var(--text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
  animation: bubble-in 0.16s ease;
  border-bottom-left-radius: 5px;
}
.msg-row.group-start .bubble { border-top-left-radius: 13px; }
.msg-row.out .bubble {
  background: var(--bubble-out);
  color: var(--bubble-out-text);
  border-bottom-left-radius: 13px;
  border-bottom-right-radius: 5px;
}
.msg-row.out.group-start .bubble { border-top-right-radius: 13px; }

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(4px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.bubble-text { white-space: pre-wrap; }

.bubble-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  opacity: 0.72;
  float: right;
  margin: 6px 0 -2px 10px;
  user-select: none;
}
.msg-row.out .bubble-meta { opacity: 0.85; }
.tick { width: 15px; height: 15px; stroke-width: 2.4; }
.tick.read { color: #6fd3ff; }

.bubble.pending { opacity: 0.65; }
.bubble.failed { outline: 1px solid var(--danger); }

/* вложения */
.bubble-image {
  display: block;
  max-width: 100%;
  max-height: 380px;
  border-radius: 9px;
  margin: -1px 0 4px;
  cursor: pointer;
  object-fit: cover;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  text-decoration: none;
  color: inherit;
}
.file-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  flex: none;
}
.file-icon .icon { width: 20px; height: 20px; }
.file-info { min-width: 0; }
.file-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.file-size { font-size: 12px; opacity: 0.75; }

.upload-progress {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  margin-top: 6px;
}
.upload-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.16s linear; }

/* «печатает…» */
.typing-line {
  padding: 0 18px 6px;
  font-size: 12.5px;
  color: var(--muted);
  height: 20px;
}

.history-loader {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  padding: 8px;
}

/* --------------------------- поле ввода --------------------------- */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--panel);
}

#message-input {
  flex: 1;
  max-height: 160px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 22px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  line-height: 1.35;
  overflow-y: auto;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}
.send-btn:hover { background: var(--accent-strong); color: #fff; }
.send-btn .icon { width: 20px; height: 20px; }

/* --------------------------- модальные окна --------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 10, 16, 0.66);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: 100%;
  max-width: 420px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 20px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { margin: 0; font-size: 19px; }

.profile-head { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0; }

.modal-footer { display: flex; justify-content: flex-end; padding-top: 4px; }

.field.compact input { padding: 10px 12px; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-title { font-weight: 600; font-size: 15px; }
.settings-hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 4px 0 0; }
.settings-section { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-of-type { border-bottom: none; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--panel-3);
  transition: background 0.18s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

/* --------------------------- звонок --------------------------- */

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a0f16;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.call-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(900px 500px at 50% 15%, rgba(42, 155, 240, 0.25), transparent 70%);
}

.call-remote {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0f16;
  display: none;
}
.call-overlay.video-active .call-remote { display: block; }
.call-overlay.video-active .call-backdrop,
.call-overlay.video-active .call-person { display: none; }

.call-local {
  position: absolute;
  right: 16px;
  top: calc(16px + env(safe-area-inset-top));
  width: 128px;
  height: 172px;
  border-radius: 14px;
  object-fit: cover;
  background: #111a22;
  display: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 2;
}
.call-overlay.video-active .call-local { display: block; }

.call-person {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 20px;
}
.call-name { font-size: 22px; font-weight: 700; color: #fff; }
.call-status { color: rgba(255, 255, 255, 0.72); font-size: 14px; }

.call-controls,
.call-incoming {
  position: absolute;
  bottom: calc(38px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 22px;
  z-index: 3;
}

.call-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}
.call-btn:hover { background: rgba(255, 255, 255, 0.22); }
.call-btn:active { transform: scale(0.94); }
.call-btn .icon { width: 25px; height: 25px; }
.call-btn.off { background: rgba(255, 255, 255, 0.9); color: #111; }
.call-btn-danger { background: var(--danger); }
.call-btn-danger:hover { background: #cf3a3f; }
.call-btn-accept { background: var(--success); }
.call-btn-accept:hover { background: #27a862; }

/* --------------------------- уведомления --------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 120;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(20, 30, 40, 0.96);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.09);
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* --------------------------- скроллбары --------------------------- */

.list-scroll::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.modal-card::-webkit-scrollbar { width: 8px; }
.list-scroll::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(125, 142, 156, 0.35);
  border-radius: 8px;
}
.list-scroll::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track { background: transparent; }

/* --------------------------- мобильная версия --------------------------- */

@media (max-width: 820px) {
  .sidebar { width: 100%; flex: 1 1 100%; border-right: none; }
  .chat-pane { display: none; }
  body.chat-open .sidebar { display: none; }
  body.chat-open .chat-pane { display: flex; }
  .back-btn { display: grid; }
  .bubble { max-width: 84%; }
  .call-local { width: 96px; height: 130px; }
  .call-btn { width: 58px; height: 58px; }
}

@media (min-width: 821px) {
  .chat-pane { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .messages { scroll-behavior: auto; }
}

/* ============================================================
   Новое: пароль с «глазиком», кодовая фраза, аккаунты
   ============================================================ */

.auth-card {
  max-height: 92dvh;
  overflow-y: auto;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input { padding-right: 46px; }

.eye-btn {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.eye-btn:hover { color: var(--text); background: var(--panel-3); }
.eye-btn .icon { width: 19px; height: 19px; }
.eye-btn.revealed { color: var(--accent); }

.username-hint {
  font-size: 12.5px;
  margin-top: -6px;
  line-height: 1.35;
}
.username-hint.ok { color: var(--success); }
.username-hint.bad { color: var(--danger); }

.auth-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  background: rgba(42, 155, 240, 0.08);
  border: 1px solid rgba(42, 155, 240, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.45;
}

.link-btn.subtle {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  margin-top: 4px;
}
.link-btn.subtle:hover { color: var(--text); }

.phrase-grid {
  list-style: none;
  margin: 2px 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  counter-reset: word;
}
.phrase-grid li {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 8px 9px 26px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phrase-grid li::before {
  counter-increment: word;
  content: counter(word);
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: var(--muted);
}

.phrase-actions { display: flex; gap: 10px; }
.phrase-actions .btn { flex: 1; }

.confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.confirm-field { display: flex; flex-direction: column; gap: 4px; }
.confirm-field span { font-size: 12px; color: var(--muted); }
.confirm-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}
.confirm-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 155, 240, 0.15);
}
.confirm-field input.wrong { border-color: var(--danger); }

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 42vh;
  overflow-y: auto;
}
.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
}
.account-item.active { border-color: var(--accent); }
.account-item-body { flex: 1; min-width: 0; }
.account-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-item-username { font-size: 12.5px; color: var(--muted); }
.account-item-badge { font-size: 11px; color: var(--accent); font-weight: 600; }
.account-remove {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.account-remove:hover { color: var(--danger); background: rgba(229, 72, 77, 0.12); }
.account-remove .icon { width: 17px; height: 17px; }

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

.btn-avatar-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  color: #d9888f;
  background: rgba(217, 110, 120, 0.1);
  border: 1px solid rgba(217, 110, 120, 0.28);
}
.btn-avatar-delete:hover { background: rgba(217, 110, 120, 0.17); }
.btn-avatar-delete .icon { width: 16px; height: 16px; }

/* --------------------------- список аккаунтов --------------------------- */

.accounts-card { max-width: 420px; }

.accounts-current {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 4px 12px;
}
.accounts-current .avatar { width: 72px; height: 72px; font-size: 26px; }
.accounts-current-name { font-size: 19px; font-weight: 700; }
.accounts-current-username { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

.accounts-section-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.accounts-list { display: flex; flex-direction: column; gap: 2px; }

.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 8px;
  border-radius: 12px;
  text-align: left;
}
.account-row:hover { background: var(--panel-2); }
.account-row.active { background: var(--panel-2); }
.account-row .avatar { width: 44px; height: 44px; font-size: 16px; }
.account-row-body { flex: 1; min-width: 0; }
.account-row-name {
  display: block;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-row-handle { display: block; font-size: 12.5px; color: var(--muted); }
.account-row-chevron { color: var(--muted); display: grid; place-items: center; }
.account-row-chevron .icon { width: 18px; height: 18px; }
.account-row-check { color: var(--accent); display: grid; place-items: center; }
.account-row-check .icon { width: 20px; height: 20px; }
.account-row-remove {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.account-row-remove:hover { color: #d9888f; background: rgba(217, 110, 120, 0.12); }
.account-row-remove .icon { width: 16px; height: 16px; }

/* --------------------------- обрезка фото --------------------------- */

.crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 10, 16, 0.74);
  backdrop-filter: blur(3px);
}

.crop-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.crop-card h2 { margin: 0; font-size: 19px; }
.crop-hint { margin: -6px 0 0; color: var(--muted); font-size: 13px; }

.crop-stage {
  position: relative;
  width: 288px;
  height: 288px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  touch-action: none;
}
.crop-canvas { display: block; cursor: grab; }
.crop-canvas:active { cursor: grabbing; }
.crop-frame {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.crop-zoom {
  width: 100%;
  accent-color: var(--accent);
}

.crop-actions { display: flex; gap: 10px; }
.crop-actions .btn { flex: 1; }
