* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root,
[data-theme="dark"] {
  --aton-bg: #050914;
  --aton-bg-elevated: #080d17;
  --aton-bg-soft: #0a101c;
  --aton-border-soft: rgba(148, 163, 184, 0.25);
  --aton-text-main: #f4f7fb;
  --aton-text-muted: #a8b2c2;
  --aton-accent-gold: #fbbf24;
  --aton-accent-amber: #fb923c;
  --aton-accent-blue: #38bdf8;
  --aton-accent-blue-deep: #0ea5e9;
  --aton-error: #f97373;
  --aton-panel: #080d17;
  --aton-sidebar-bg: #0b1220;
  --aton-msg-own: rgba(56, 189, 248, 0.1);
  --aton-msg-other: rgba(30, 41, 59, 0.6);
  --golos-surface: rgba(12, 20, 36, 0.78);
  --golos-surface-2: rgba(15, 23, 42, 0.55);
  --golos-stroke: rgba(148, 163, 184, 0.18);
  --golos-stroke-bright: rgba(56, 189, 248, 0.28);
  --golos-text2: #cbd5e1;
  /* UI rhythm / Telegram-like */
  --aton-separator: rgba(148, 163, 184, 0.14);
  --aton-bubble-incoming: #2b3039;
  --aton-bubble-incoming-border: rgba(255, 255, 255, 0.08);
  --aton-avatar-border: rgba(255, 255, 255, 0.1);
  --aton-msg-col-gap: 2px;
  --aton-compose-pad-y: 10px;
  --aton-control-btn-size: 40px;
}

[data-theme="light"] {
  --aton-bg: #ffffff;
  --aton-bg-elevated: #ffffff;
  --aton-bg-soft: #f4f6f8;
  --aton-border-soft: rgba(0, 0, 0, 0.08);
  --aton-text-main: #1a1a2e;
  --aton-text-muted: #6b7280;
  --aton-accent-gold: #c27803;
  --aton-accent-amber: #d4590c;
  --aton-accent-blue: #2563eb;
  --aton-accent-blue-deep: #1d4ed8;
  --aton-error: #dc2626;
  --aton-panel: #ffffff;
  --aton-sidebar-bg: #f9fafb;
  --aton-msg-own: #eff6ff;
  --aton-msg-other: #f4f6f8;
  --golos-surface: rgba(255, 255, 255, 0.97);
  --golos-surface-2: #f1f5f9;
  --golos-stroke: rgba(15, 23, 42, 0.08);
  --golos-stroke-bright: rgba(37, 99, 235, 0.2);
  --golos-text2: #64748b;
  --aton-separator: rgba(0, 0, 0, 0.07);
  --aton-bubble-incoming: #e8edf2;
  --aton-bubble-incoming-border: rgba(0, 0, 0, 0.1);
  --aton-avatar-border: rgba(0, 0, 0, 0.08);
}

html {
  width: 100%;
  height: 100%;
  /* iOS Safari: цепочка height:100% иногда даёт нулевую высоту без fill-available */
  min-height: -webkit-fill-available;
}

body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: -webkit-fill-available;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--aton-bg);
  color: var(--aton-text-main);
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body,
:root:not([data-theme="light"]) body {
  background: var(--aton-bg);
}

[data-theme="light"] body {
  background: #ffffff;
}

body {
  display: flex;
}

#app {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

.aton-shell {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  background: var(--aton-bg);
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  transition: background 0.3s ease;
}

[data-theme="light"] .aton-shell {
  background: #ffffff;
  border-top-color: var(--aton-border-soft);
}

.aton-sidebar {
  width: 320px;
  border-right: 1px solid var(--aton-border-soft);
  background: var(--aton-sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}

[data-theme="light"] .aton-sidebar {
  background: #f9fafb;
  border-right-color: rgba(0, 0, 0, 0.06);
}

.aton-sidebar-header {
  padding: 16px 18px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.aton-sidebar-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.aton-lang-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
}

.aton-lang-switcher--topbar {
  margin: 0 2px 0 0;
}

.aton-auth-lang {
  display: none;
  justify-content: center;
  padding-top: 12px;
}

.aton-sidebar-lang-footer {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.aton-shell--guest-landing .aton-auth-lang {
  display: flex;
}

.aton-shell--guest-landing .aton-sidebar-lang-footer {
  display: none;
}

.aton-lang-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.aton-lang-btn.active {
  border-color: var(--aton-accent-blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

[data-theme="light"] .aton-lang-btn {
  background: #fff;
  color: #111827;
  border-color: rgba(15, 23, 42, 0.18);
}

.aton-flag {
  position: relative;
  display: block;
  width: 20px;
  height: 14px;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}

.aton-flag--ru {
  background: linear-gradient(to bottom, #ffffff 0 33.333%, #1d4ed8 33.333% 66.666%, #dc2626 66.666% 100%);
}

.aton-flag--de {
  background: linear-gradient(to bottom, #111827 0 33.333%, #dc2626 33.333% 66.666%, #facc15 66.666% 100%);
}

.aton-flag--gb {
  background-color: #1e3a8a;
  background-image:
    linear-gradient(33deg, transparent 0 40%, #ffffff 40% 47%, #dc2626 47% 53%, #ffffff 53% 60%, transparent 60% 100%),
    linear-gradient(147deg, transparent 0 40%, #ffffff 40% 47%, #dc2626 47% 53%, #ffffff 53% 60%, transparent 60% 100%),
    linear-gradient(to bottom, transparent 0 35%, #ffffff 35% 43%, #dc2626 43% 57%, #ffffff 57% 65%, transparent 65% 100%),
    linear-gradient(to right, transparent 0 35%, #ffffff 35% 43%, #dc2626 43% 57%, #ffffff 57% 65%, transparent 65% 100%);
}

/* Дублирует тему и друзей с топбара: в шапке сайдбара, на мобиле — в одной строке с логотипом */
.aton-sidebar-toolbar {
  display: none;
}

.aton-logo {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: block;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.5);
}

.aton-product-name {
  display: flex;
  flex-direction: column;
}

.aton-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.aton-subtitle {
  font-size: 11px;
  color: var(--aton-text-muted);
}

.aton-auth {
  padding: 12px 18px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.35) 0%, transparent 100%);
}

.aton-auth-tabs {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  padding: 3px;
  border: 1px solid rgba(71, 85, 105, 0.65);
  margin-bottom: 14px;
  width: 100%;
  box-sizing: border-box;
}

.aton-auth-tab {
  border: none;
  background: transparent;
  color: var(--aton-text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.aton-auth-tab.active {
  background: radial-gradient(circle at top, #f97316, #facc15);
  color: #020617;
}

.aton-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.aton-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
}

.aton-input-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #94a3b8;
}

.aton-input {
  margin-top: 0;
  padding: 11px 12px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(100, 116, 139, 0.55);
  background: rgba(15, 23, 42, 0.92);
  color: #e5e7eb;
  font-size: 16px;
  width: 100%;
  box-sizing: border-box;
}

.aton-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow:
    0 0 0 1px rgba(251, 146, 60, 0.5),
    0 0 20px rgba(251, 191, 36, 0.12);
}

.aton-primary-button {
  margin-top: 4px;
  padding: 14px 18px;
  min-height: 48px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  background: linear-gradient(120deg, #fb923c, #eab308);
  color: #020617;
  box-shadow: 0 8px 28px rgba(248, 181, 81, 0.45);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, filter 0.12s ease-out;
}

.aton-primary-button:hover {
  filter: brightness(1.05);
}

.aton-primary-button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 18px rgba(248, 181, 81, 0.5);
}

.aton-auth-hint {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--aton-text-muted);
  text-align: center;
}

.aton-auth-footer {
  margin-top: 4px;
  text-align: center;
}

.aton-auth-link {
  color: var(--aton-accent-blue);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  padding-bottom: 1px;
}

.aton-auth-link:hover {
  color: #7dd3fc;
  border-bottom-color: rgba(125, 211, 252, 0.55);
}

.aton-chats {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.aton-chats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--aton-text-muted);
  padding: 2px 6px 2px 10px;
  min-height: 34px;
}

.aton-new-chat-button {
  border: none;
  border-radius: 999px;
  padding: 3px 10px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.aton-new-chat-button:hover {
  background: rgba(30, 64, 175, 0.9);
}

.aton-create-group-button {
  min-height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.04);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  flex-shrink: 0;
}

.aton-create-group-button:hover {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(96, 165, 250, 0.48);
  color: #bfdbfe;
}

.aton-create-group-button:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.7);
  outline-offset: 2px;
}

.aton-create-group-plus {
  font-size: 15px;
  font-weight: 500;
  line-height: 0;
  margin-top: -1px;
}

.aton-create-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(18px);
}

.aton-create-chat-panel {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.98);
  color: #0f172a;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.aton-create-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.aton-create-chat-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.aton-create-chat-subtitle {
  margin-top: 5px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.aton-create-chat-close {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.aton-create-chat-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.aton-create-chat-field + .aton-create-chat-field {
  margin-top: 14px;
}

.aton-create-chat-field .aton-input-label {
  margin-bottom: 7px;
  color: #64748b;
}

.aton-create-chat-field .aton-input-label span {
  color: #94a3b8;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.aton-create-chat-field .aton-input {
  border-color: rgba(148, 163, 184, 0.34);
  background: #ffffff;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.aton-create-chat-field textarea.aton-input {
  min-height: 92px;
  resize: none;
  line-height: 1.45;
  padding-top: 11px;
}

.aton-create-chat-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: #f1f5f9;
}

.aton-create-chat-segment button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.aton-create-chat-segment button.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.aton-create-chat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.aton-create-chat-secondary,
.aton-create-chat-primary {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.aton-create-chat-secondary {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
  color: #2563eb;
}

.aton-create-chat-secondary:hover {
  background: #eff6ff;
}

.aton-create-chat-primary {
  border: 0;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.aton-create-chat-primary:hover {
  background: #1d4ed8;
}

.aton-search {
  padding: 0 0 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aton-search-input {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(31, 41, 55, 0.95);
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  font-size: 12px;
}

.aton-search-input:focus {
  outline: none;
  border-color: var(--aton-accent-blue);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.aton-search-input.aton-search-onboarding {
  border-color: rgba(56, 189, 248, 0.95);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.aton-search-results {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aton-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 10px;
  border: none;
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.aton-search-item span {
  color: var(--aton-text-muted);
}

.aton-search-item:hover {
  background: rgba(37, 99, 235, 0.85);
}

.aton-search-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.aton-search-name {
  font-weight: 600;
  font-size: 12px;
  color: inherit !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-search-handle {
  font-size: 10px;
  opacity: 0.6;
}

.aton-search-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.aton-search-action {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(55, 65, 81, 0.8);
  background: rgba(15, 23, 42, 0.7);
  color: #94a3b8;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.aton-search-action:hover {
  background: rgba(37, 99, 235, 0.3);
  color: #e5e7eb;
}

.aton-search-join {
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-weight: 500;
}

.aton-search-join:hover {
  background: rgba(56, 189, 248, 0.18);
  color: #e5e7eb;
}

.aton-search-join:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.aton-search-section-title {
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--aton-text-muted);
  padding: 8px 8px 4px;
  margin: 0;
}

.aton-search-item--user {
  cursor: default;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid rgba(31, 41, 55, 0.85);
  overflow: hidden;
}

.aton-search-item--user:hover {
  background: rgba(30, 58, 138, 0.55);
  border-color: rgba(56, 189, 248, 0.35);
}

.aton-search-user-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 480px) {
  .aton-search-user-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
}

.aton-search-user-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s;
}

.aton-search-user-main:hover {
  background: rgba(15, 23, 42, 0.35);
}

.aton-search-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(145deg, #1d4ed8, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.aton-search-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aton-search-avatar--letter {
  color: #f8fafc;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}

.aton-search-item--user .aton-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 0;
  width: 100%;
  justify-content: flex-start;
}

@media (min-width: 480px) {
  .aton-search-item--user .aton-search-actions {
    width: auto;
    margin-left: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    flex-shrink: 0;
  }
}

.aton-search-write {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  border-color: rgba(37, 99, 235, 0.75);
  font-weight: 600;
}

.aton-search-write:hover:not(:disabled) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff !important;
}

.aton-search-write:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.aton-search-add {
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

.aton-search-add:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
}

.aton-search-add:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: #64748b;
  border-color: rgba(71, 85, 105, 0.55);
}

.aton-search-block {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.aton-search-block:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.18);
  color: #fecaca;
}

.aton-search-verified {
  color: #38bdf8;
  font-size: 0.9em;
  vertical-align: middle;
}

.aton-search-accept {
  border-color: rgba(34, 197, 94, 0.55);
  color: #86efac;
  font-weight: 600;
}

.aton-search-accept:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.15);
}

.aton-search-decline {
  border-color: rgba(148, 163, 184, 0.45);
  color: #94a3b8;
}

.aton-search-cancel-req {
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.aton-peer-action-bar {
  flex-shrink: 0;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.aton-peer-action-bar[hidden] {
  display: none !important;
}

.aton-peer-action-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.aton-peer-action-label {
  font-size: 11px;
  color: var(--aton-text-muted);
  min-width: 0;
}

.aton-peer-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.aton-peer-btn {
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(55, 65, 81, 0.85);
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.aton-peer-btn:hover {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(56, 189, 248, 0.4);
}

.aton-peer-block {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.aton-peer-muted {
  font-size: 11px;
  color: #64748b;
}

.aton-peer-notify-toggle {
  min-width: 40px;
  padding-inline: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aton-peer-notify-toggle--muted {
  border-color: rgba(148, 163, 184, 0.45);
  color: #94a3b8;
}

.aton-peer-action-row--head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
}

.aton-peer-rename-local {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin: 0;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

.aton-peer-rename-local:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
}

.aton-peer-rename-local:active {
  transform: scale(0.98);
}

.aton-peer-rename-local-icon {
  flex-shrink: 0;
  opacity: 0.55;
}

.aton-peer-rename-local:hover .aton-peer-rename-local-icon {
  opacity: 0.95;
}

.aton-peer-rename-local-text {
  white-space: nowrap;
}

.aton-peer-action-inner--toolbar-only {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  justify-content: flex-start;
}

.aton-peer-action-inner--toolbar-only .aton-peer-action-btns {
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.aton-peer-rename-local--icon {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
  justify-content: center;
}

@media (max-width: 400px) {
  .aton-peer-rename-local-text {
    white-space: normal;
    text-align: left;
    line-height: 1.25;
    max-width: 12rem;
  }
}

.aton-peer-alias-overlay {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.aton-peer-alias-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.aton-peer-alias-modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 20px 20px 18px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.aton-peer-alias-heading {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--aton-text, #f1f5f9);
}

.aton-peer-alias-lead {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
}

.aton-peer-alias-footnote {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: #64748b;
}

.aton-peer-alias-input {
  margin-bottom: 0;
}

.aton-peer-alias-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.aton-friends-overlay {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* Иначе display:flex перебивает нативное [hidden] — оверлей виден при загрузке и не закрывается */
.aton-friends-overlay[hidden] {
  display: none !important;
  pointer-events: none;
}

@media (min-width: 640px) {
  .aton-friends-overlay {
    align-items: center;
  }
}

.aton-friends-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
}

.aton-friends-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  max-height: min(90vh, 640px);
  margin: 12px;
  padding: 0 0 16px;
  border-radius: 16px 16px 0 0;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 640px) {
  .aton-friends-panel {
    border-radius: 16px;
    margin: 20px;
  }
}

.aton-friends-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.aton-friends-panel-title {
  font-size: 15px;
  font-weight: 650;
}

.aton-friends-panel-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.aton-friends-panel-close:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #e5e7eb;
}

.aton-friends-hint {
  margin: 0 16px 12px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--aton-text-muted);
}

.aton-friends-section {
  padding: 0 16px 12px;
  overflow-y: auto;
}

.aton-friends-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--aton-text-muted);
  margin-bottom: 8px;
}

.aton-friends-count {
  font-weight: 600;
  color: #38bdf8;
}

.aton-friends-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(55, 65, 81, 0.5);
}

.aton-friends-row-main {
  min-width: 0;
}

.aton-friends-row-name {
  font-size: 13px;
  font-weight: 600;
  display: block;
}

.aton-friends-row-handle {
  font-size: 11px;
  color: var(--aton-text-muted);
}

.aton-friends-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.aton-friends-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(55, 65, 81, 0.8);
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
  cursor: pointer;
}

.aton-friends-accept {
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.aton-friends-decline {
  border-color: rgba(148, 163, 184, 0.45);
  color: #94a3b8;
}

.aton-friends-muted {
  font-size: 11px;
  color: #64748b;
}

.aton-friends-empty {
  font-size: 12px;
  color: var(--aton-text-muted);
  padding: 8px 0;
}

/* Стек всплывающих карточек (fallback, если нет разрешения на системные уведомления) */
.aton-toast-stack {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 400;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}

.aton-toast-card {
  pointer-events: auto;
  text-align: left;
  width: 100%;
  max-width: 380px;
  padding: 14px 16px 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.97), rgba(30, 41, 59, 0.92));
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(56, 189, 248, 0.12) inset;
  backdrop-filter: blur(16px);
  cursor: pointer;
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.aton-toast-card--in {
  transform: translateX(0);
  opacity: 1;
}

.aton-toast-card--out {
  transform: translateX(110%) scale(0.96);
  opacity: 0;
}

.aton-toast-card-kicker {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 6px;
}

.aton-toast-card-title {
  font-size: 15px;
  font-weight: 650;
  color: #f8fafc;
  line-height: 1.25;
  margin-bottom: 4px;
}

.aton-toast-card-body {
  font-size: 13px;
  line-height: 1.45;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aton-chat-notify-off {
  display: inline-flex;
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.85;
  vertical-align: middle;
}

.aton-chat-item--notify-muted .aton-chat-item-title {
  opacity: 0.92;
}

.aton-notify-permission-btn {
  color: #38bdf8 !important;
}

[data-theme="light"] .aton-toast-card {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow:
    0 16px 48px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(37, 99, 235, 0.08) inset;
}

[data-theme="light"] .aton-toast-card-title {
  color: #0f172a;
}

[data-theme="light"] .aton-toast-card-body {
  color: #475569;
}

[data-theme="light"] .aton-notify-permission-btn {
  color: #2563eb !important;
}

.aton-chat-list {
  margin-top: 4px;
  padding: 4px 6px 8px;
  border-radius: 0;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.aton-chat-list-empty {
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--aton-text-muted);
  text-align: center;
}

.aton-chat-onboarding {
  width: 100%;
  padding: 2px 6px 6px;
  margin: 0;
}

.aton-chat-onboarding .aton-chat-onboarding-card {
  position: relative;
}

.aton-chat-onboarding-card {
  padding: 8px 10px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(31, 41, 55, 0.85);
}

.aton-chat-onboarding-title {
  font-size: 12px;
  font-weight: 650;
  opacity: 0.95;
  margin-bottom: 6px;
}

.aton-chat-onboarding-desc {
  font-size: 10.5px;
  line-height: 1.45;
  opacity: 0.82;
  margin-bottom: 8px;
}

.aton-chat-onboarding-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.aton-onboarding-cta {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  font-size: 11px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease-out, filter 0.12s ease-out, box-shadow 0.12s ease-out;
}

.aton-onboarding-cta-primary {
  background: radial-gradient(circle at top, var(--aton-accent-blue), var(--aton-accent-blue-deep));
  color: #020617;
  box-shadow: 0 10px 26px rgba(56, 189, 248, 0.14);
}

.aton-onboarding-cta-primary:hover {
  filter: brightness(1.05);
}

.aton-onboarding-cta-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.aton-onboarding-cta-secondary:hover {
  background: rgba(30, 64, 175, 0.35);
}

.aton-chat-item {
  position: relative;
  border-radius: 10px;
  border: none;
  margin: 0 0 1px;
  padding: 10px 10px 10px 8px;
  min-height: 64px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--aton-text-main);
  font: inherit;
  text-align: left;
  -webkit-text-fill-color: currentColor;
  transition: background 0.12s ease-out;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.aton-chat-item::after {
  content: "";
  position: absolute;
  left: 58px;
  right: 10px;
  bottom: 0;
  height: 1px;
  background: var(--aton-separator);
  pointer-events: none;
}

.aton-chat-list .aton-chat-item:last-child::after {
  display: none;
}

.aton-chat-item-title {
  color: var(--aton-text-main);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.25;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-chat-item-subtitle {
  font-size: 12px;
  line-height: 1.2;
  color: var(--aton-text-muted);
  opacity: 1;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-chat-item-preview {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.35;
  color: var(--aton-text-muted);
  opacity: 0.92;
  margin-top: 2px;
}

.aton-chat-item.active {
  background: rgba(14, 165, 233, 0.15);
  box-shadow:
    inset 3px 0 0 #38bdf8,
    inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.aton-chat-item:not(.active):hover {
  background: rgba(30, 41, 59, 0.62);
}

.aton-chat-item:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.38);
  outline-offset: -3px;
}

.aton-chat-item-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.aton-chat-pin {
  font-size: 11px;
  color: #fbbf24;
  margin-left: 4px;
}

.aton-chat-item-title-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-chat-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #38bdf8;
  font-size: 11px;
  line-height: 1;
  margin-left: 6px;
  flex-shrink: 0;
  pointer-events: none;
}

.aton-chat-menu-btn {
  border: none;
  border-radius: 999px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: rgba(148, 163, 184, 0.85);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
}

.aton-chat-item:hover .aton-chat-menu-btn,
.aton-chat-item.active .aton-chat-menu-btn,
.aton-chat-item:active .aton-chat-menu-btn,
.aton-chat-item:focus-within .aton-chat-menu-btn {
  opacity: 1;
  pointer-events: auto;
}

.aton-chat-menu-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  color: #38bdf8;
}

.aton-chat-menu-dropdown {
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(55, 65, 81, 0.9);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.9);
  padding: 6px;
  min-width: 170px;
}

.aton-chat-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.aton-chat-menu-item:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
}

.aton-chat-menu-item:disabled {
  opacity: 0.45;
  cursor: default;
}

.aton-chat-unread-badge {
  min-width: 20px;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #38bdf8;
  color: #020617;
  font-size: 11px;
  font-weight: 750;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.aton-chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: 6px;
  font-size: 10px;
  color: var(--aton-text-muted);
  flex-shrink: 0;
  min-width: 0;
  max-width: 72px;
  overflow: hidden;
}

.aton-chat-time {
  font-size: 11px;
  line-height: 1.2;
  color: var(--aton-text-muted);
  opacity: 0.88;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: radial-gradient(circle at top, #facc15, #f97316 70%, #7c2d12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  box-shadow: 0 0 0 1px var(--aton-avatar-border) inset;
}

.aton-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aton-chat-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  line-height: 0;
}

.aton-chat-avatar-status-dot {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px var(--aton-sidebar-bg);
  pointer-events: none;
}

.aton-chat-online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: middle;
  background: #4b5563;
}

.aton-chat-online-dot.online {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}

.aton-chat-online-dot.offline {
  background: #4b5563;
}

.aton-chat-item-delete {
  margin-left: 6px;
  border: none;
  border-radius: 999px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: rgba(148, 163, 184, 0.85);
  cursor: pointer;
  font-size: 12px;
}

.aton-chat-item-delete:hover {
  background: rgba(15, 23, 42, 0.9);
  color: #f97316;
}

.aton-chat-verify-menu {
  display: none;
  margin-left: 6px;
  border: none;
  border-radius: 999px;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: rgba(148, 163, 184, 0.85);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  flex-shrink: 0;
}

.aton-chat-item:hover .aton-chat-verify-menu,
.aton-chat-item.active .aton-chat-verify-menu {
  display: inline-flex;
}

.aton-chat-verify-menu:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.9);
  color: #38bdf8;
}

.aton-chat-verify-menu:disabled {
  opacity: 0.65;
  cursor: default;
}

.aton-profile-link {
  margin-top: auto;
  padding: 8px 12px 10px;
  font-size: 11px;
  color: var(--aton-text-muted);
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  cursor: pointer;
}

.aton-profile-link span {
  text-decoration: underline;
}

.aton-profile-page {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--aton-bg);
}

.aton-profile-page[hidden] {
  display: none !important;
}

.aton-profile-page-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 22px clamp(18px, 4vw, 56px) 34px;
  scrollbar-color: #475569 #0f172a;
}

.aton-profile-page-scroll::-webkit-scrollbar {
  width: 10px;
}

.aton-profile-page-scroll::-webkit-scrollbar-track {
  background: #0f172a;
}

.aton-profile-page-scroll::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 999px;
  border: 2px solid #0f172a;
}

.aton-profile-mobile-nav {
  display: none;
}

.aton-profile-mobile-back {
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 14px;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(96, 165, 250, 0.12);
  color: #bfdbfe;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.aton-profile-mobile-back span[aria-hidden="true"] {
  font-size: 28px;
  line-height: 1;
  margin-top: -2px;
}

.aton-profile-hero {
  width: min(860px, 100%);
  margin: 0 auto 16px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(55, 65, 81, 0.85);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.82));
  box-shadow: 0 22px 70px rgba(2, 6, 23, 0.28);
}

.aton-profile-back {
  display: none;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  margin-bottom: 18px;
  background: rgba(148, 163, 184, 0.12);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 12px;
}

.aton-profile-back:hover {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
}

.aton-profile-hero-main {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.aton-profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #facc15, #f97316 68%, #7c2d12);
  border: 2px solid rgba(56, 189, 248, 0.35);
  color: #111827;
  font-size: 42px;
  font-weight: 750;
}

.aton-profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aton-profile-hero-copy {
  min-width: 0;
}

.aton-profile-hero h1 {
  margin: 0 0 2px;
  color: #f8fafc;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.12;
  letter-spacing: 0;
}

.aton-profile-public-id {
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 12px;
}

.aton-profile-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.aton-profile-verify-pill,
.aton-profile-email-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 650;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.aton-profile-verify-pill span {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: 11px;
}

.aton-profile-verify-pill.is-verified {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.28);
}

.aton-profile-verify-pill.is-verified span {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.aton-profile-avatar-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.aton-profile-avatar-upload:hover {
  background: rgba(56, 189, 248, 0.2);
}

.aton-profile-form {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(55, 65, 81, 0.85);
  background: rgba(15, 23, 42, 0.72);
}

.aton-profile-section-title {
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 750;
  margin-bottom: 16px;
}

.aton-profile-field + .aton-profile-field {
  margin-top: 16px;
}

.aton-profile-field .aton-input {
  width: 100%;
}

.aton-profile-field .aton-input[readonly] {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.35);
  cursor: default;
}

.aton-profile-help {
  margin-top: 6px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.35;
}

.aton-profile-language-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aton-profile-lang-btn {
  width: auto;
  min-width: 136px;
  height: 42px;
  border-radius: 14px;
  padding: 0 13px;
  gap: 9px;
  justify-content: flex-start;
  background: rgba(15, 23, 42, 0.36);
  color: #e5e7eb;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  border-color: rgba(148, 163, 184, 0.24);
}

.aton-profile-lang-btn:hover {
  background: rgba(30, 41, 59, 0.62);
  border-color: rgba(56, 189, 248, 0.34);
}

.aton-profile-lang-btn.active {
  background: rgba(37, 99, 235, 0.16);
}

.aton-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.aton-profile-actions .aton-new-chat-button,
.aton-profile-actions .aton-profile-logout-button,
.aton-profile-actions .aton-primary-button {
  margin-top: 0;
  min-height: 48px;
  border-radius: 16px;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aton-profile-actions .aton-new-chat-button {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.24);
  color: #93c5fd;
}

.aton-profile-actions .aton-new-chat-button:hover {
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
}

.aton-profile-actions .aton-profile-logout-button {
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  cursor: pointer;
}

.aton-profile-actions .aton-profile-logout-button:hover {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.aton-profile-actions .aton-primary-button {
  padding-inline: 18px;
}

.aton-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--aton-bg);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.aton-topbar {
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  min-height: 48px;
  height: auto;
  border-bottom: 1px solid var(--aton-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px));
  padding-top: max(6px, env(safe-area-inset-top, 0px));
  background: var(--aton-bg-elevated);
}

.aton-back-button {
  display: none;
  background: none;
  border: none;
  color: var(--aton-accent, #c27803);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

.aton-back-button:active {
  background: rgba(194, 120, 3, 0.12);
}

.aton-topbar-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  padding: 0 4px 0 0;
}

.aton-topbar-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.aton-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.aton-topbar-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aton-topbar-title-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aton-title-text {
  white-space: normal;
  line-height: 1.25;
}

.aton-verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #38bdf8;
  font-size: 11px;
  line-height: 1;
}

.aton-topbar-status {
  font-size: 12px;
  color: var(--aton-text-muted);
  line-height: 1.25;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.88;
  margin-top: 2px;
}

.aton-topbar-status--online {
  color: rgba(52, 211, 153, 0.95);
}

.aton-topbar--guest .aton-topbar-title {
  font-size: 15px;
  font-weight: 600;
}

.aton-topbar--guest .aton-topbar-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aton-topbar--guest .aton-topbar-status {
  max-width: 100%;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aton-topbar-icon {
  position: relative;
  border: none;
  border-radius: 10px;
  width: var(--aton-control-btn-size, 40px);
  height: var(--aton-control-btn-size, 40px);
  min-width: var(--aton-control-btn-size, 40px);
  min-height: var(--aton-control-btn-size, 40px);
  padding: 0;
  background: rgba(15, 23, 42, 0.55);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.18) inset;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.aton-topbar-icon:hover {
  background: rgba(15, 23, 42, 0.85);
}

.aton-topbar-icon:active {
  transform: scale(0.97);
}

.aton-topbar-icon-badge {
  position: absolute;
  right: 0;
  top: 0;
  transform: translate(40%, -40%);
  min-width: 14px;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.95);
  color: #020617;
  font-size: 9px;
}

.aton-topbar-icon.active {
  background: radial-gradient(circle at top, #38bdf8, #0ea5e9);
  color: #020617;
}

.aton-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(55, 65, 81, 0.9);
  font-size: 12px;
  position: relative;
  padding-left: 18px;
  cursor: pointer;
}

.aton-user-pill::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4b5563;
}

.aton-user-pill.online::before {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.aton-user-pill.offline::before {
  background: #6b7280;
}

.aton-user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  overflow: hidden;
  background: radial-gradient(circle at top, #facc15, #f97316 70%, #7c2d12);
}

.aton-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aton-chat {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px max(12px, env(safe-area-inset-left, 0px)) 6px
    max(12px, env(safe-area-inset-right, 0px));
  gap: 6px;
  overflow: hidden;
}

.aton-chat[hidden] {
  display: none !important;
}

.aton-messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  /* Меньше неожиданных «подскоков» scroll anchoring браузера при догрузке медиа */
  overflow-anchor: none;
  padding: 4px 6px 8px 2px;
  display: flex;
  flex-direction: column;
  gap: var(--aton-msg-col-gap, 2px);
  -webkit-font-smoothing: antialiased;
  /* optimizeLegibility тяжелее при длинных лентах */
  text-rendering: auto;
  /* Слой для композитинга (часто сглаживает скролл на слабых GPU) */
  transform: translateZ(0);
}

/* Проверка «низ в кадре» для auto-scroll (IntersectionObserver), без зависимости от дрожа scrollHeight */
.aton-messages-bottom-sentinel {
  flex: 0 0 1px;
  width: 100%;
  height: 1px;
  min-height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  align-self: stretch;
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}

.aton-load-older {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 8px auto 12px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--aton-accent-blue, #2563eb) 22%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--aton-panel, #ffffff) 88%, var(--aton-accent-blue, #2563eb) 12%), color-mix(in srgb, var(--aton-panel, #ffffff) 94%, var(--aton-accent-gold, #fbbf24) 6%));
  color: var(--aton-text-muted, #64748b);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.2;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  cursor: pointer;
  user-select: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.aton-load-older:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--aton-accent-blue, #2563eb) 34%, transparent);
  color: var(--aton-text-main, #0f172a);
}

.aton-load-older__spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--aton-accent-blue, #2563eb) 20%, transparent);
  border-top-color: var(--aton-accent-blue, #2563eb);
  opacity: 0.62;
}

.aton-load-older.is-loading {
  color: var(--aton-text-main, #0f172a);
  cursor: default;
}

.aton-load-older.is-loading .aton-load-older__spinner {
  opacity: 1;
  animation: aton-spin 0.8s linear infinite;
}

@keyframes aton-spin {
  to {
    transform: rotate(360deg);
  }
}

.aton-message-skeleton {
  width: min(900px, 100%);
  margin: auto;
  padding: 18px 10px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aton-message-skeleton__chip {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--aton-accent-blue, #2563eb) 18%, transparent);
  background: color-mix(in srgb, var(--aton-panel, #ffffff) 88%, transparent);
  color: var(--aton-text-muted);
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}

.aton-message-skeleton__chip .aton-load-older__spinner {
  opacity: 1;
  animation: aton-spin 0.8s linear infinite;
}

.aton-message-skeleton__row {
  display: flex;
  justify-content: flex-start;
}

.aton-message-skeleton__row.is-mine {
  justify-content: flex-end;
}

.aton-message-skeleton__bubble {
  width: min(var(--skeleton-width, 58%), 520px);
  min-width: 210px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--aton-border-soft) 72%, transparent);
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--aton-accent-blue, #2563eb) 10%, transparent), transparent),
    color-mix(in srgb, var(--aton-msg-other, #f4f6f8) 88%, var(--aton-panel, #ffffff) 12%);
  background-size: 220% 100%, auto;
  animation: aton-skeleton-sheen 1.35s ease-in-out infinite;
}

.aton-message-skeleton__row.is-mine .aton-message-skeleton__bubble {
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--aton-accent-gold, #fbbf24) 13%, transparent), transparent),
    color-mix(in srgb, var(--aton-msg-own, #eff6ff) 88%, var(--aton-panel, #ffffff) 12%);
}

.aton-message-skeleton__bubble span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--aton-text-muted) 18%, transparent);
}

.aton-message-skeleton__bubble span + span {
  margin-top: 10px;
}

.aton-message-skeleton__bubble span:nth-child(1) {
  width: 88%;
}

.aton-message-skeleton__bubble span:nth-child(2) {
  width: 64%;
}

.aton-message-skeleton__bubble span:nth-child(3) {
  width: 36%;
}

@keyframes aton-skeleton-sheen {
  0% {
    background-position: 180% 0, 0 0;
  }
  100% {
    background-position: -80% 0, 0 0;
  }
}

.aton-message-row {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  padding: 1px 0 3px;
  margin: 0;
  /* content-visibility убран: при смене видимости строк scrollHeight/scrollTop «дрожат»,
     из‑за чего лента при скролле вверх может визуально уезжать вниз. */
}

/* Личный чат 1:1: в треде только пузырь и время (как Telegram), без колонки аватара */
.aton-message-date-separator {
  align-self: center;
  margin: 11px auto 9px;
  padding: 5px 12px;
  max-width: min(86%, 360px);
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #334155;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  user-select: none;
}

[data-theme="dark"] .aton-message-date-separator,
:root:not([data-theme="light"]) .aton-message-date-separator {
  background: rgba(30, 41, 59, 0.88);
  border-color: rgba(148, 163, 184, 0.18);
  color: #e5edf8;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.aton-chat--private-dm .aton-message-inner {
  gap: 0;
}

/* Личка: пузырь до ~85% ширины треда (на широких экранах не остаётся огромной полосы справа, как у Telegram) */
.aton-message-row--private-dm .aton-message-bubble {
  max-width: min(85%, 1080px);
}

/* личка + голос: тот же ползунок, что и в группе */
.aton-message-row--private-dm .aton-message-bubble--voice {
  width: min(360px, 58%);
  max-width: min(360px, 58%);
  min-width: 0;
  box-sizing: border-box;
}

/* Как у голоса без текста: иначе входящие «ГС+текст» растягиваются до 85%/1080px, исходящие ГС остаются ~360px */
.aton-message-row--private-dm .aton-message-bubble--voice:has(.aton-message-text-body) {
  width: min(360px, 58%);
  max-width: min(360px, 58%);
}

/* Страховка: в личке не показываем строки имён, даже при старом кэше main.js */
.aton-chat--private-dm .aton-message-sender,
.aton-chat--private-dm .aton-message-sender--self {
  display: none !important;
}

.aton-chat--private-dm .aton-message-row:not(.self) {
  justify-content: flex-start;
  align-self: stretch;
}

.aton-chat--private-dm .aton-message-row.self {
  justify-content: flex-end;
  align-self: stretch;
}

.aton-message-row.self {
  justify-content: flex-end;
}

/* width: 100% — иначе inner сжат под пузырь и 96% в max-width пузыря = цикл → «узкий» пузырь и лишние переносы короткого текста */
.aton-message-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.aton-message-row.self .aton-message-inner {
  flex-direction: row-reverse;
}

.aton-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: radial-gradient(circle at top, #facc15, #f97316 70%, #7c2d12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 0 0 1px var(--aton-avatar-border) inset;
  align-self: flex-end;
}

.aton-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* max-width % теперь от полноширинного .aton-message-inner, не от shrink-wrap. width: max-content — одна строка по смыслу, пока влезает в max-width */
.aton-message-bubble {
  display: block;
  flex: 0 1 auto;
  width: max-content;
  max-width: min(96%, 1000px);
  min-width: 0;
  padding: 8px 12px 7px 12px;
  border-radius: 12px 12px 12px 4px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: normal;
  background: var(--aton-bubble-incoming, #2b3039);
  border: 1px solid var(--aton-bubble-incoming-border, rgba(255, 255, 255, 0.1));
  color: #f3f4f6;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12) inset, 0 1px 2px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* 100% ширины пузыря: иначе flex/max-content сжимает длинный текст и голос в «колонку» */
.aton-message-text {
  text-align: left;
  display: block;
  width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Ширина текста = ширина пузыря (а не max-content, иначе узкая «колонка») */
.aton-message-text-body {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  /* Иначе \n в сообщении (боты, длинные отчёты) схлопываются в один абзац */
  white-space: pre-wrap;
}

.aton-message-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.aton-message-link:hover {
  opacity: 0.86;
}

.aton-link-preview-card {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  grid-template-areas:
    "bar body"
    "bar media";
  gap: 0 10px;
  margin-top: 8px;
  padding: 10px;
  width: min(440px, 100%);
  max-width: 100%;
  min-width: 0;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  text-align: left;
  background: rgba(15, 23, 42, 0.09);
  border: 1px solid rgba(15, 23, 42, 0.1);
  overflow: hidden;
  box-sizing: border-box;
  contain: layout paint;
}

.aton-message-bubble:has(.aton-link-preview-card) {
  width: min(520px, 96%);
  max-width: min(520px, 96%);
}

.aton-message-bubble.self .aton-link-preview-card {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(15, 23, 42, 0.08);
}

.aton-link-preview-bar {
  grid-area: bar;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.68), rgba(14, 165, 233, 0.48));
}

.aton-link-preview-body {
  grid-area: body;
  min-width: 0;
  overflow: hidden;
}

.aton-link-preview-site {
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(37, 99, 235, 0.95);
}

.aton-link-preview-card[data-provider="youtube"] .aton-link-preview-site {
  color: #ef4444;
}

.aton-link-preview-title {
  font-weight: 800;
  line-height: 1.25;
  color: currentColor;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}

.aton-link-preview-description {
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: currentColor;
  opacity: 0.76;
  font-size: 13px;
  line-height: 1.35;
}

.aton-link-preview-media {
  grid-area: media;
  position: relative;
  width: 100%;
  margin-top: 9px;
  aspect-ratio: 16 / 9;
  min-height: 160px;
  max-height: 245px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.12);
}

.aton-link-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
}

.aton-link-preview-play {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 46px;
  height: 32px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}

.aton-link-preview-play::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 9px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #fff;
}

.aton-link-preview-card--loading {
  opacity: 0.84;
}

.aton-admin-quick-menu {
  position: fixed;
  z-index: 12000;
  display: grid;
  gap: 6px;
  width: min(280px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
}

.aton-admin-quick-menu button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.aton-admin-quick-menu button:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.1);
}

.aton-admin-quick-menu button:disabled {
  cursor: default;
  opacity: 0.55;
}

[data-theme="dark"] .aton-admin-quick-menu,
:root:not([data-theme="light"]) .aton-admin-quick-menu {
  background: #101827;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.52);
}

[data-theme="dark"] .aton-admin-quick-menu button,
:root:not([data-theme="light"]) .aton-admin-quick-menu button {
  color: #f8fafc;
}

[data-theme="dark"] .aton-admin-quick-menu button:hover:not(:disabled),
:root:not([data-theme="light"]) .aton-admin-quick-menu button:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.18);
}

[data-theme="light"] .aton-admin-quick-menu {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .aton-admin-quick-menu button {
  color: #0f172a;
}

.aton-message-text--media {
  min-width: 0;
  width: min(260px, 100%);
  max-width: min(260px, calc(100vw - 32px));
}

/* Голос: фиксированная «нормальная» ширина полосы, не max-content-узкое (кнопка+трек на всю ширину) */
.aton-message-bubble--voice {
  width: min(360px, 58%);
  max-width: min(360px, 58%);
  min-width: 0;
  box-sizing: border-box;
}

/* Голос + текст: та же ширина полосы, что и у чистого ГС; текст переносится внутри пузыря */
.aton-message-bubble--voice:has(.aton-message-text-body) {
  width: min(360px, 58%);
  max-width: min(360px, 58%);
}

.aton-message-text--media.aton-message-text--voice {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Скрытый audio (управление из кастомного UI) */
.aton-voice-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.aton-voice-player {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  box-sizing: border-box;
}

.aton-voice-player--self {
  flex-direction: row-reverse;
}

.aton-voice-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.aton-voice-player--self .aton-voice-main {
  align-items: flex-end;
}

.aton-voice-play {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease, background 0.2s ease;
}

.aton-voice-play:hover {
  background: rgba(15, 23, 42, 0.95);
  transform: scale(1.04);
}

.aton-voice-play:active {
  transform: scale(0.98);
}

.aton-voice-player--playing .aton-voice-play {
  background: rgba(56, 189, 248, 0.35);
  color: #f0f9ff;
}

.aton-voice-icon {
  display: block;
}

.aton-voice-player:not(.aton-voice-player--playing) .aton-voice-icon--pause {
  display: none;
}

.aton-voice-player--playing .aton-voice-icon--play {
  display: none;
}

.aton-voice-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.aton-voice-track:focus-visible {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
}

.aton-voice-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #22d3ee);
  pointer-events: none;
}

.aton-message-bubble.self .aton-voice-progress-fill {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.aton-voice-time {
  font-size: 11px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.aton-message-bubble.self .aton-voice-time {
  text-align: right;
}

.aton-message-bubble.self .aton-voice-play {
  background: rgba(28, 25, 23, 0.18);
  color: #1c1917;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.aton-message-bubble.self .aton-voice-play:hover {
  background: rgba(28, 25, 23, 0.28);
}

.aton-message-bubble.self .aton-voice-player--playing .aton-voice-play {
  background: rgba(180, 83, 9, 0.35);
  color: #1c1917;
}

.aton-message-bubble:not(.self) .aton-voice-track {
  background: rgba(15, 23, 42, 0.45);
}

.aton-message-text--media + .aton-message-meta {
  margin-top: 0;
}

.aton-message-image {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 10px;
  margin: 8px 0 6px;
  cursor: zoom-in;
  background: rgba(15, 23, 42, 0.08);
  transition: transform 140ms ease, filter 140ms ease;
}

.aton-message-image:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.aton-message-bubble.self {
  background: linear-gradient(155deg, #f59e0b 0%, #fbbf24 45%, #fde68a 100%);
  color: #1c1917;
  border: 1px solid rgba(180, 83, 9, 0.35);
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 1px 3px rgba(0, 0, 0, 0.12);
}

.aton-message-bubble.self .aton-message-text {
  text-align: right;
}

.aton-message-bubble.self .aton-message-sender--self {
  text-align: right;
  width: 100%;
  color: rgba(28, 25, 23, 0.65);
}

.aton-message-sender {
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
  margin-bottom: 2px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-message-sender-badge {
  color: #38bdf8;
  font-size: 11px;
}

.aton-message-sender--self {
  color: rgba(17, 24, 39, 0.55);
}

/* Входные анимации отключены для полного рендера — иначе при pullChatReceipts/сокетах
   все пузыри снова «въезжали» с opacity:0 (мигание/прыжки). Новое сообщение без отдельного
   class-based enter — визуально стабильнее. */

.aton-message-meta {
  text-align: right;
  margin-top: 1px;
}

.aton-message-meta--self {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 3px 6px;
}

.aton-message-ack {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

.aton-message-ack-tick {
  display: inline-block;
  margin-left: -0.1em;
  color: rgba(28, 25, 23, 0.58);
  opacity: 1;
  text-shadow: 0 0 0 currentColor;
}

.aton-message-ack--delivered .aton-message-ack-tick {
  color: rgba(28, 25, 23, 0.58);
  opacity: 1;
}

.aton-message-ack--read .aton-message-ack-tick {
  color: #0ea5e9;
  opacity: 1;
}

[data-theme="light"] .aton-message-ack--read .aton-message-ack-tick {
  color: #0b63f6;
}

/* На своём пузыре (тёплый/зелёный фон) старый «бирюзовый» сливался; «прочитано» — явный синий, как в Telegram */
.aton-message-bubble.self .aton-message-ack--read .aton-message-ack-tick {
  color: #0758d8;
  opacity: 1;
}
.aton-message-bubble.self .aton-message-ack--delivered .aton-message-ack-tick {
  color: rgba(28, 25, 23, 0.58);
  opacity: 1;
}
.aton-message-bubble.self
  .aton-message-ack:not(.aton-message-ack--delivered):not(.aton-message-ack--read)
  .aton-message-ack-tick {
  color: rgba(28, 25, 23, 0.58);
  opacity: 1;
}
[data-theme="light"] .aton-message-bubble.self .aton-message-ack--read .aton-message-ack-tick {
  color: #0758d8;
}
[data-theme="light"] .aton-message-bubble.self .aton-message-ack--delivered .aton-message-ack-tick {
  color: rgba(15, 23, 42, 0.62);
}

.aton-search-friend-ok {
  font-size: 12px;
  font-weight: 600;
  color: var(--aton-text-muted, #9ca3af);
  padding: 4px 0;
  white-space: nowrap;
}

.aton-message-time {
  font-size: 12px;
  opacity: 0.65;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.aton-message-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.aton-message-bubble:hover .aton-message-actions,
.aton-message-actions:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.aton-message-action-button {
  border: 1px solid transparent;
  background: transparent;
  color: rgba(203, 213, 225, 0.48);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  border-radius: 999px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.aton-message-action-button:hover {
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.16);
  color: rgba(241, 245, 249, 0.86);
  transform: translateY(-1px);
}

.aton-message-action-button:focus-visible,
.aton-reaction-pill:focus-visible,
.aton-reaction-picker-item:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.4);
  outline-offset: 2px;
}

.aton-message-action-button.is-active,
.aton-message-react-trigger.is-active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.28);
  color: rgba(191, 219, 254, 0.92);
}

.aton-message-react-trigger {
  gap: 5px;
}

.aton-message-react-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aton-message-react-plus {
  stroke-width: 2.2;
}

.aton-message-react-current {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 16px;
  line-height: 1;
}

.aton-message-action-button.aton-message-reply-button {
  width: 28px;
  min-width: 28px;
  padding: 0;
}

.aton-message-reply-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aton-message-reply-button:hover {
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(96, 165, 250, 0.3);
  color: rgba(191, 219, 254, 0.9);
}

.aton-message-reply-button:active {
  transform: translateY(0) scale(0.94);
}

.aton-message-action-button.aton-message-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.22);
  color: rgba(252, 165, 165, 0.92);
}

.aton-message-action-button.aton-message-report-button {
  font-size: 12px;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.82);
}

.aton-message-action-button.aton-message-report-button:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.24);
  color: rgba(253, 230, 138, 0.95);
}

[data-theme="light"] .aton-message-action-button {
  background: transparent;
  border-color: transparent;
  color: rgba(71, 85, 105, 0.48);
  box-shadow: none;
}

[data-theme="light"] .aton-message-action-button:hover {
  background: rgba(100, 116, 139, 0.09);
  border-color: rgba(100, 116, 139, 0.16);
  color: #334155;
}

[data-theme="light"] .aton-message-action-button.aton-message-report-button:hover {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.2);
  color: #92400e;
}

[data-theme="light"] .aton-message-reply-button:hover {
  background: rgba(37, 99, 235, 0.09);
  border-color: rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
}

[data-theme="light"] .aton-message-action-button.is-active,
[data-theme="light"] .aton-message-react-trigger.is-active {
  background: rgba(37, 99, 235, 0.11);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
}

[data-theme="light"] .aton-message-action-button.aton-message-delete:hover {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.aton-user-verify-button {
  border: none;
  border-radius: 999px;
  padding: 0 4px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: rgba(148, 163, 184, 0.6);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  vertical-align: middle;
  margin-left: 2px;
}

.aton-user-verify-button:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.95);
  color: #38bdf8;
  transform: translateY(-1px);
}

.aton-user-verify-button:disabled {
  opacity: 0.7;
  cursor: default;
  transform: none;
}

.aton-message-reply-preview {
  font-size: 11px;
  color: #e5e7eb;
  padding: 6px 8px;
  margin-bottom: 6px;
  border-left: 3px solid rgba(56, 189, 248, 0.9);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.18);
  max-width: 100%;
  overflow: hidden;
}

.aton-message-reply-author {
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  color: #7dd3fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-message-reply-text {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(229, 231, 235, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-message-reactions {
  margin-top: 8px;
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}

.aton-reaction-pill {
  border: 1px solid rgba(148, 163, 184, 0.24);
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.76);
  color: #e2e8f0;
  cursor: pointer;
  min-width: 48px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(2, 6, 23, 0.13);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.aton-reaction-pill-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 18px;
  line-height: 1;
}

.aton-reaction-pill-count {
  min-width: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.aton-reaction-pill:hover {
  background: rgba(30, 41, 59, 0.98);
  border-color: rgba(125, 211, 252, 0.54);
  transform: translateY(-2px);
}

.aton-reaction-pill.is-active {
  background: #0758d8;
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 5px 16px rgba(7, 88, 216, 0.3);
}

.aton-reaction-pill.is-active .aton-reaction-pill-count {
  color: #ffffff;
}

[data-theme="light"] .aton-reaction-pill {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.14);
  color: #334155;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .aton-reaction-pill-count {
  color: #475569;
}

[data-theme="light"] .aton-reaction-pill:hover {
  background: #f8fafc;
  border-color: rgba(37, 99, 235, 0.42);
}

[data-theme="light"] .aton-reaction-pill.is-active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.aton-reaction-picker {
  z-index: 80;
  padding: 8px;
  border-radius: 18px;
  background: rgba(8, 15, 30, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow:
    0 22px 54px rgba(2, 6, 23, 0.48),
    0 2px 8px rgba(2, 6, 23, 0.28);
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  animation: aton-reaction-pop 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.aton-reaction-picker-list {
  display: grid;
  grid-template-columns: repeat(8, 46px);
  gap: 4px;
}

.aton-reaction-picker-item {
  position: relative;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.06);
  cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 25px;
  line-height: 1;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.14s ease;
}

.aton-reaction-picker-item:hover:not(:disabled),
.aton-reaction-picker-item:focus-visible {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(125, 211, 252, 0.36);
  transform: translateY(-3px) scale(1.08);
}

.aton-reaction-picker-item.is-active {
  background: rgba(14, 165, 233, 0.24);
  border-color: #38bdf8;
  box-shadow: inset 0 0 0 1px rgba(186, 230, 253, 0.18);
}

.aton-reaction-picker-item.is-active::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border: 2px solid #08101f;
  border-radius: 999px;
  background: #38bdf8;
}

.aton-reaction-picker-item:disabled {
  cursor: wait;
  opacity: 0.58;
}

[data-theme="light"] .aton-reaction-picker {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow:
    0 22px 54px rgba(15, 23, 42, 0.2),
    0 2px 8px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .aton-reaction-picker-item {
  background: #f8fafc;
}

[data-theme="light"] .aton-reaction-picker-item:hover:not(:disabled),
[data-theme="light"] .aton-reaction-picker-item:focus-visible {
  background: #eaf2ff;
  border-color: rgba(37, 99, 235, 0.36);
}

[data-theme="light"] .aton-reaction-picker-item.is-active {
  background: #dbeafe;
  border-color: #2563eb;
}

[data-theme="light"] .aton-reaction-picker-item.is-active::after {
  border-color: #ffffff;
  background: #2563eb;
}

@keyframes aton-reaction-pop {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aton-message-actions,
  .aton-message-action-button,
  .aton-reaction-pill,
  .aton-reaction-picker,
  .aton-reaction-picker-item {
    animation: none;
    transition: none;
  }
}

/* ——— Голос Атона: панель, ожидание, пустое состояние (единая система) ——— */
.aton-golos-voice-bar {
  position: relative;
  flex-shrink: 0;
  margin: 0 2px;
  padding: 0;
  border: 1px solid var(--golos-stroke);
  border-bottom: 1px solid var(--golos-stroke-bright);
  border-radius: 14px 14px 0 0;
  background: var(--golos-surface);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.aton-golos-voice-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, var(--aton-accent-amber) 0%, var(--aton-accent-blue) 42%, var(--aton-accent-blue-deep) 100%);
  opacity: 0.85;
  pointer-events: none;
}
.aton-golos-voice-bar[hidden] {
  display: none !important;
}
.aton-golos-voice-bar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px 16px;
  padding: 12px 14px 10px;
  max-width: 100%;
  margin: 0 auto;
}
.aton-golos-voice-bar-main {
  min-width: 0;
  padding-top: 2px;
}
.aton-golos-voice-bar-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--aton-accent-blue);
  margin: 0 0 4px 0;
}
.aton-golos-voice-bar-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--aton-text-main);
  margin: 0 0 4px 0;
}
.aton-golos-voice-bar-sub {
  font-size: 12px;
  line-height: 1.5;
  color: var(--golos-text2);
  margin: 0;
  max-width: 42ch;
}
.aton-golos-voice-cta,
.aton-golos-empty .aton-golos-empty-voice-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  color: #020617;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(145deg, #7dd3fc 0%, var(--aton-accent-blue) 40%, var(--aton-accent-blue-deep) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 4px 20px -4px rgba(14, 165, 233, 0.55);
  transition:
    transform 0.12s ease,
    box-shadow 0.2s ease,
    filter 0.15s ease;
}
.aton-golos-voice-cta .aton-golos-cta-ic {
  display: flex;
  opacity: 0.95;
}
.aton-golos-voice-cta:hover,
.aton-golos-empty .aton-golos-empty-voice-btn:hover {
  filter: brightness(1.04);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16) inset,
    0 6px 24px -4px rgba(14, 165, 233, 0.6);
}
.aton-golos-voice-cta:active,
.aton-golos-empty .aton-golos-empty-voice-btn:active {
  transform: scale(0.98);
}
.aton-golos-voice-cta:focus-visible,
.aton-golos-empty .aton-golos-empty-voice-btn:focus-visible {
  outline: 2px solid var(--aton-accent-blue);
  outline-offset: 2px;
}
.aton-golos-voice-cta:disabled,
.aton-golos-voice-cta[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.aton-golos-pending {
  width: 100%;
  max-width: 100%;
  padding: 6px 0 2px;
  flex-shrink: 0;
}
.aton-golos-pending-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--golos-surface-2);
  border: 1px solid var(--golos-stroke);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
}
.aton-golos-pending-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--aton-accent-amber), var(--aton-accent-blue));
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}
.aton-golos-pending-copy {
  min-width: 0;
  flex: 1;
  padding-top: 1px;
}
.aton-golos-pending-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--aton-text-main);
  margin: 0 0 2px 0;
}
.aton-golos-pending-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aton-accent-blue);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--golos-stroke-bright);
  border-radius: 6px;
  padding: 2px 7px;
}
.aton-golos-pending-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--aton-text-muted);
  margin: 0;
}
.aton-golos-typing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 2px 0 0;
  flex-shrink: 0;
}
.aton-golos-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--aton-accent-blue);
  opacity: 0.4;
  animation: aton-golos-typing 1.25s ease-in-out infinite;
}
.aton-golos-typing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}
.aton-golos-typing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}
@keyframes aton-golos-typing {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .aton-golos-typing-dots span {
    animation: none;
    opacity: 0.6;
  }
}
.aton-golos-empty {
  text-align: center;
}
.aton-golos-empty-hero {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
}
.aton-golos-empty-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(56, 189, 248, 0.28),
    rgba(15, 23, 42, 0) 60%
  );
  pointer-events: none;
}
.aton-golos-empty-hero .aton-golos-empty-icon {
  position: relative;
  z-index: 1;
  color: var(--aton-accent-blue);
  filter: drop-shadow(0 2px 12px rgba(14, 165, 233, 0.35));
}
.aton-golos-empty .aton-golos-empty-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--aton-accent-amber);
  margin: 0 0 6px 0;
}
.aton-golos-empty .aton-empty-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.aton-golos-empty .aton-empty-subtitle {
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  color: var(--aton-text-muted);
}
.aton-golos-empty .aton-golos-empty-tiny {
  max-width: 28rem;
  margin: 12px auto 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--aton-text-muted);
  opacity: 0.92;
}
.aton-golos-empty .aton-golos-empty-voice-btn {
  margin-top: 20px;
  min-height: 44px;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 8px 28px -6px rgba(14, 165, 233, 0.45);
}
.aton-golos-empty .aton-golos-empty-actions {
  margin-top: 0;
}

/* ——— Голос Атона: фон и поле ввода под голос; лента и композ на всю ширину чата (как обычная личка, без центрированной «колонки ChatGPT»). ——— */
.aton-main--golos {
  background: var(--aton-bg-soft);
}

/* Явно: лента и низ не сужаются (на случай кэша старого CSS или сторонних правил). */
.aton-chat--golos .aton-messages {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  align-self: stretch;
}

.aton-compose--golos {
  border-top: none;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent 0%, var(--aton-bg-soft) 28%);
  gap: 8px;
}

/* Два ряда: иначе на узких экранах кнопки уезжали за край (overflow) */
.aton-compose--golos .aton-compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 10px;
  column-gap: 0;
  align-items: center;
  padding: 10px 12px 12px 12px;
  border-radius: 28px;
  border: 1px solid var(--golos-stroke);
  background: var(--golos-surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  width: 100%;
  box-sizing: border-box;
}

.aton-compose--golos .aton-compose-input {
  grid-row: 1;
  min-height: 44px;
  padding: 10px 8px;
  border: none;
  background: transparent;
  border-radius: 0;
  width: 100% !important;
  flex: none !important;
  max-width: none;
}

.aton-compose--golos .aton-compose-actions {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 14px;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

.aton-compose--golos .aton-send-button {
  display: none !important;
}

.aton-compose--golos .aton-compose-input:focus {
  outline: none;
  box-shadow: none;
}

.aton-compose--golos .aton-attach-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.12);
}

.aton-compose--golos .aton-mic-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.35) 0%, rgba(14, 165, 233, 0.55) 100%);
  border: 1px solid var(--golos-stroke-bright);
  box-shadow: 0 4px 18px -4px rgba(14, 165, 233, 0.45);
}

.aton-compose--golos .aton-mic-button:hover {
  filter: brightness(1.06);
}

.aton-compose--golos .aton-mic-button.recording {
  background: radial-gradient(circle at top, #fb7185, #b91c1c);
  border-color: rgba(248, 113, 113, 0.5);
}

.aton-compose--golos .aton-mic-button svg {
  width: 22px;
  height: 22px;
}

.aton-compose--golos .aton-voice-preview {
  width: 100%;
  box-sizing: border-box;
}

.aton-golos-empty--gpt .aton-golos-empty-hero {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
}

.aton-golos-empty-gpt-title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 8px 0;
  color: var(--aton-text-main);
}

.aton-golos-empty-gpt-lead {
  max-width: 26rem;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.55;
  color: var(--aton-text-muted);
}

.aton-golos-empty-tiny--gpt {
  margin-top: 10px !important;
}

.aton-golos-empty-focus-btn {
  margin-top: 18px;
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--golos-stroke-bright);
  background: var(--golos-surface);
  color: var(--aton-text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.aton-golos-empty-focus-btn:hover {
  background: var(--golos-surface-2);
}

[data-theme="light"] .aton-main--golos {
  background: #f4f6f8;
}

[data-theme="light"] .aton-compose--golos .aton-compose-row {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.aton-compose {
  border-top: 1px solid var(--aton-border-soft);
  padding: var(--aton-compose-pad-y, 10px) max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
  background: var(--aton-bg-elevated);
}

.aton-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  padding: 5px 6px 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--aton-border-soft);
  background: rgba(15, 23, 42, 0.45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.aton-compose-record-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(185, 28, 28, 0.22);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
  font-size: 12px;
  line-height: 1.35;
  animation: aton-record-hint-pulse 1.2s ease-in-out infinite;
}

/* Иначе display:flex выше перебивает нативное [hidden] и плашка не скрывается */
.aton-compose-record-hint[hidden] {
  display: none !important;
}

@keyframes aton-record-hint-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.25);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.12);
  }
}

.aton-compose-record-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f87171;
  flex-shrink: 0;
  animation: aton-record-dot 1s ease-in-out infinite;
}

@keyframes aton-record-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(0.92);
  }
}

.aton-compose-record-timer {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2.5em;
}

.aton-compose-record-text {
  flex: 1;
  min-width: 12em;
  opacity: 0.95;
}

.aton-reply-compose {
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.aton-reply-compose[hidden] {
  display: none !important;
}

.aton-reply-compose-accent {
  width: 3px;
  height: 34px;
  border-radius: 999px;
  background: #38bdf8;
}

.aton-reply-compose-body {
  min-width: 0;
}

.aton-reply-compose-label {
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  color: #7dd3fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-reply-compose-text {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.35;
  color: #dbeafe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aton-reply-compose-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(148, 163, 184, 0.18);
  color: #e5e7eb;
  font-size: 22px;
  line-height: 1;
}

.aton-reply-compose-close:hover {
  background: rgba(248, 113, 113, 0.3);
}

.aton-voice-preview {
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.aton-voice-preview[hidden] {
  display: none !important;
}

.aton-voice-preview-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.aton-voice-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #38bdf8;
  flex-shrink: 0;
}

.aton-voice-preview-label {
  font-size: 12px;
  font-weight: 600;
  color: #e5e7eb;
}

.aton-voice-preview-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  margin-right: auto;
}

.aton-voice-preview-play {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  flex-shrink: 0;
  padding: 0;
}

.aton-voice-preview-play:hover {
  filter: brightness(1.08);
}

.aton-voice-preview-cancel {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.25);
  color: #e5e7eb;
}

.aton-voice-preview-cancel:hover {
  background: rgba(248, 113, 113, 0.35);
}

.aton-voice-preview-send {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #020617;
}

.aton-voice-preview-send:hover {
  filter: brightness(1.06);
}

.aton-compose-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.aton-typing-indicator {
  font-size: 11px;
  color: var(--aton-text-muted);
  margin-bottom: 4px;
  margin-left: 6px;
}

.aton-compose-input {
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  min-height: 40px;
  max-height: min(40vh, 200px);
  padding: 8px 4px 8px 2px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 15px;
  line-height: 1.45;
  font-family: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  resize: none;
  overflow-y: auto;
  box-sizing: border-box;
  scrollbar-color: #475569 #0f172a;
}

.aton-compose-input::placeholder {
  color: #94a3b8;
  opacity: 0.88;
}

.aton-compose-input::-webkit-scrollbar {
  width: 10px;
}

.aton-compose-input::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 999px;
}

.aton-compose-input::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 999px;
  border: 2px solid #0f172a;
}

.aton-compose-input::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.aton-compose-input:focus {
  outline: none;
  box-shadow: none;
}

.aton-compose-row:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.aton-send-button {
  border-radius: 999px;
  border: none;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 12px;
  background: radial-gradient(circle at top, var(--aton-accent-blue), var(--aton-accent-blue-deep));
  color: #020617;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.aton-send-icon {
  display: none;
}

.aton-send-button:hover {
  filter: brightness(1.05);
}

.aton-mic-button,
.aton-attach-button {
  width: var(--aton-control-btn-size, 40px);
  height: var(--aton-control-btn-size, 40px);
  min-width: var(--aton-control-btn-size, 40px);
  min-height: var(--aton-control-btn-size, 40px);
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(30, 41, 59, 0.95);
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2) inset;
  transition: background 0.12s ease, transform 0.12s ease;
}

.aton-mic-button:hover,
.aton-attach-button:hover {
  background: rgba(51, 65, 85, 0.98);
}

.aton-mic-button:active,
.aton-attach-button:active {
  transform: scale(0.97);
}

.aton-mic-button.recording {
  background: radial-gradient(circle at top, #fb7185, #b91c1c);
  color: #fee2e2;
}

.aton-image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
}

.aton-image-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 16px;
  box-shadow: 0 32px 120px rgba(0, 0, 0, 0.9);
}

.aton-image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.aton-image-lightbox-close:hover {
  background: rgba(30, 41, 59, 0.92);
}

.aton-image-lightbox-nav {
  position: fixed;
  top: 50%;
  width: 52px;
  height: 72px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.56);
  color: #ffffff;
  font-size: 48px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
}

.aton-image-lightbox-nav:hover {
  background: rgba(30, 41, 59, 0.9);
}

.aton-image-lightbox-nav--prev {
  left: 22px;
}

.aton-image-lightbox-nav--next {
  right: 22px;
}

.aton-image-lightbox-counter {
  position: fixed;
  left: 50%;
  bottom: 18px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  transform: translateX(-50%);
}

.aton-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  text-align: center;
  padding: 24px;
  animation: aton-empty-fade 360ms ease-out;
}

.aton-empty-state--landing {
  align-items: stretch;
  text-align: left;
  justify-content: flex-start;
  max-width: 26rem;
  margin: 0 auto;
  padding: 24px 20px 32px;
  box-sizing: border-box;
}

.aton-empty-state--pick {
  max-width: 22rem;
  margin: auto;
  padding: 28px 20px;
}

.aton-empty-kicker {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--aton-accent-blue);
  margin: 0 0 10px;
  opacity: 0.95;
}

.aton-empty-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  opacity: 0.95;
  margin: 0 0 12px;
}

.aton-empty-state--landing .aton-empty-title {
  font-size: 21px;
}

/* Только десктоп: крупный символ солнца в гостевом лендинге */
.aton-landing-logo {
  display: none;
}

.aton-empty-lead {
  font-size: 15px;
  line-height: 1.65;
  color: var(--aton-text-muted);
  margin: 0;
  font-weight: 400;
}

.aton-empty-subtitle {
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.88;
  margin-bottom: 10px;
  color: #cbd5e1;
}

.aton-empty-meta {
  font-size: 13px;
  line-height: 1.55;
  opacity: 0.65;
  max-width: 36ch;
}

@media (min-width: 841px) {
  .aton-empty-state--landing {
    text-align: center;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  .aton-empty-state--landing .aton-empty-kicker,
  .aton-empty-state--landing .aton-empty-title,
  .aton-empty-state--landing .aton-empty-lead {
    text-align: center;
    width: 100%;
    max-width: 34rem;
    margin-left: auto;
    margin-right: auto;
  }

  .aton-empty-state--landing .aton-empty-title {
    font-size: 24px;
  }

  .aton-landing-logo {
    display: block;
    position: relative;
    width: clamp(120px, 16vw, 220px);
    height: clamp(120px, 16vw, 220px);
    margin: 0 auto 28px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: contain;
    box-shadow:
      0 0 48px rgba(251, 191, 36, 0.55),
      0 0 96px rgba(251, 146, 60, 0.22);
  }
}

@keyframes aton-empty-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== VERIFY EMAIL SCREEN ===== */
.aton-verify-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: 20px;
}

.aton-verify-card {
  text-align: center;
  max-width: 400px;
  padding: 40px 32px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.aton-verify-card .aton-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
}

.aton-verify-card h2 {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.aton-verify-card p {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.aton-verify-card .aton-resend-btn {
  margin-top: 20px;
  width: 100%;
}

.aton-verify-card .aton-resend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aton-verify-hint {
  color: var(--gold);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 8px;
}

.aton-logout-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 16px;
  text-decoration: underline;
}

.aton-logout-link:hover {
  color: var(--text);
}

/* ===== EMPTY STATE ICON ===== */
.aton-empty-icon {
  color: var(--aton-accent-blue);
  opacity: 0.5;
  margin-bottom: 16px;
}

/* ===== ONBOARDING ICON ===== */
.aton-chat-onboarding-icon {
  color: var(--aton-accent-blue);
  opacity: 0.6;
  margin-bottom: 8px;
}

/* ===== LIGHT THEME OVERRIDES ===== */
[data-theme="light"] .aton-auth {
  background: none;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-new-chat-button {
  background: #f0f4ff;
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .aton-new-chat-button:hover {
  background: #dbeafe;
}

[data-theme="light"] .aton-create-group-button {
  background: #ffffff;
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .aton-create-group-button:hover {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.36);
}

[data-theme="light"] .aton-create-chat-overlay {
  background: rgba(15, 23, 42, 0.34);
}

[data-theme="light"] .aton-chats-header {
  color: #6b7280;
}

[data-theme="light"] .aton-main {
  background: #ffffff;
  backdrop-filter: none;
}

[data-theme="light"] .aton-sidebar-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-title {
  color: #1a1a2e;
}

[data-theme="light"] .aton-subtitle {
  color: #6b7280;
}

[data-theme="light"] .aton-chats {
  border-bottom-color: var(--aton-border-soft);
}

[data-theme="light"] .aton-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--aton-border-soft);
}

[data-theme="light"] .aton-topbar-title,
[data-theme="light"] .aton-title-text {
  color: #1a1a2e;
}

[data-theme="light"] .aton-topbar-status {
  color: #6b7280;
}

[data-theme="light"] .aton-topbar-status--online {
  color: #059669;
}

[data-theme="light"] .aton-topbar-icon {
  background: #f1f5f9;
  color: #334155;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06) inset;
}

[data-theme="light"] .aton-topbar-icon:hover {
  background: #e2e8f0;
}

[data-theme="light"] .aton-topbar-icon.active {
  background: var(--aton-accent-blue);
  color: #ffffff;
  box-shadow: none;
}

[data-theme="light"] .aton-back-button {
  color: var(--aton-accent-blue);
}

[data-theme="light"] .aton-chat-item {
  color: var(--aton-text-main);
}

[data-theme="light"] .aton-chat-item:hover {
  background: #f0f4ff;
}

[data-theme="light"] .aton-chat-item.active {
  background: #e0e7ff;
  box-shadow:
    inset 3px 0 0 #2563eb,
    inset 0 0 0 1px rgba(37, 99, 235, 0.28);
}

[data-theme="light"] .aton-chat-avatar {
  background: linear-gradient(135deg, #e0e7ff, #dbeafe);
  color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
}

[data-theme="light"] .aton-chat-item-title {
  color: #1a1a2e;
}

[data-theme="light"] .aton-chat-item-subtitle,
[data-theme="light"] .aton-chat-item-preview {
  color: #526071;
}

[data-theme="light"] .aton-chat-time {
  color: #526071;
  opacity: 1;
}

[data-theme="light"] .aton-message-bubble {
  background: var(--aton-bubble-incoming, #e8edf2);
  color: #0f172a;
  border: 1px solid var(--aton-bubble-incoming-border, rgba(0, 0, 0, 0.1));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .aton-message-bubble.self {
  background: #c8e6b4;
  color: #0f172a;
  border: 1px solid rgba(22, 101, 52, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-message-sender {
  color: #2563eb;
}

[data-theme="light"] .aton-message-bubble.self .aton-message-sender--self {
  color: rgba(17, 24, 39, 0.55);
}

[data-theme="light"] .aton-message-reply-preview {
  background: rgba(255, 255, 255, 0.48);
  border-left-color: rgba(37, 99, 235, 0.85);
}

[data-theme="light"] .aton-message-reply-author {
  color: #2563eb;
}

[data-theme="light"] .aton-message-reply-text {
  color: rgba(15, 23, 42, 0.72);
}

[data-theme="light"] .aton-message-bubble:not(.self) .aton-voice-play {
  background: rgba(255, 255, 255, 0.95);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-message-bubble:not(.self) .aton-voice-play:hover {
  background: #fff;
}

[data-theme="light"] .aton-message-bubble:not(.self) .aton-voice-player--playing .aton-voice-play {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.35);
}

[data-theme="light"] .aton-message-bubble:not(.self) .aton-voice-track {
  background: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .aton-message-bubble.self .aton-voice-play {
  background: rgba(255, 255, 255, 0.95);
  color: #15803d;
  border: 1px solid rgba(21, 128, 61, 0.25);
}

[data-theme="light"] .aton-message-bubble.self .aton-voice-play:hover {
  background: #fff;
}

[data-theme="light"] .aton-message-bubble.self .aton-voice-player--playing .aton-voice-play {
  background: rgba(21, 128, 61, 0.2);
  border-color: rgba(21, 128, 61, 0.4);
}

[data-theme="light"] .aton-messages,
[data-theme="light"] .aton-chat-list,
[data-theme="light"] .aton-search-results {
  scrollbar-color: #cbd5e1 #f1f5f9;
}

[data-theme="light"] .aton-messages::-webkit-scrollbar,
[data-theme="light"] .aton-chat-list::-webkit-scrollbar,
[data-theme="light"] .aton-search-results::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme="light"] .aton-messages::-webkit-scrollbar-track,
[data-theme="light"] .aton-chat-list::-webkit-scrollbar-track,
[data-theme="light"] .aton-search-results::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

[data-theme="light"] .aton-messages::-webkit-scrollbar-thumb,
[data-theme="light"] .aton-chat-list::-webkit-scrollbar-thumb,
[data-theme="light"] .aton-search-results::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

[data-theme="light"] .aton-messages::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .aton-chat-list::-webkit-scrollbar-thumb:hover,
[data-theme="light"] .aton-search-results::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

:root:not([data-theme="light"]) .aton-messages,
:root:not([data-theme="light"]) .aton-chat-list,
:root:not([data-theme="light"]) .aton-search-results {
  scrollbar-color: #475569 #0f172a;
}

:root:not([data-theme="light"]) .aton-messages::-webkit-scrollbar,
:root:not([data-theme="light"]) .aton-chat-list::-webkit-scrollbar,
:root:not([data-theme="light"]) .aton-search-results::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

:root:not([data-theme="light"]) .aton-messages::-webkit-scrollbar-track,
:root:not([data-theme="light"]) .aton-chat-list::-webkit-scrollbar-track,
:root:not([data-theme="light"]) .aton-search-results::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 4px;
}

:root:not([data-theme="light"]) .aton-messages::-webkit-scrollbar-thumb,
:root:not([data-theme="light"]) .aton-chat-list::-webkit-scrollbar-thumb,
:root:not([data-theme="light"]) .aton-search-results::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

[data-theme="light"] .aton-messages {
  background: #ffffff;
}

[data-theme="light"] .aton-golos-voice-bar {
  background: var(--golos-surface);
  border-color: var(--golos-stroke);
  border-bottom-color: var(--golos-stroke-bright);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}
[data-theme="light"] .aton-golos-pending-card {
  background: #f8fafc;
  border-color: var(--golos-stroke);
}
[data-theme="light"] .aton-golos-typing-dots span {
  background: var(--aton-accent-blue);
}
[data-theme="light"] .aton-golos-pending-badge {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.18);
}
[data-theme="light"] .aton-golos-empty-hero::after {
  background: radial-gradient(
    circle at 30% 30%,
    rgba(37, 99, 235, 0.2),
    rgba(255, 255, 255, 0) 60%
  );
}
[data-theme="light"] .aton-golos-voice-cta,
[data-theme="light"] .aton-golos-empty .aton-golos-empty-voice-btn {
  color: #0f172a;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4) inset,
    0 6px 20px -4px rgba(37, 99, 235, 0.35);
}
[data-theme="light"] .aton-golos-empty .aton-golos-empty-eyebrow {
  color: #c2410c;
}

[data-theme="light"] .aton-compose {
  background: #ffffff;
  border-top: 1px solid var(--aton-border-soft);
}

[data-theme="light"] .aton-compose-row {
  background: #f0f2f5;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

[data-theme="light"] .aton-compose-row:focus-within {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

[data-theme="light"] .aton-compose-input {
  background: transparent;
  color: #0f172a;
  border: none;
  scrollbar-color: #cbd5e1 #f8fafc;
}

[data-theme="light"] .aton-compose-input::placeholder {
  color: #64748b;
  opacity: 0.9;
}

[data-theme="light"] .aton-compose-input::-webkit-scrollbar-track {
  background: #f8fafc;
}

[data-theme="light"] .aton-compose-input::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-color: #f8fafc;
}

[data-theme="light"] .aton-compose-input::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

[data-theme="light"] .aton-mic-button,
[data-theme="light"] .aton-attach-button {
  background: #ffffff;
  color: #475569;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
}

[data-theme="light"] .aton-mic-button:hover,
[data-theme="light"] .aton-attach-button:hover {
  background: #e8ecf0;
}

[data-theme="light"] .aton-compose-record-hint {
  background: rgba(254, 226, 226, 0.96);
  border-color: rgba(248, 113, 113, 0.4);
  color: #991b1b;
}

[data-theme="light"] .aton-compose-record-text {
  color: #7f1d1d;
}

[data-theme="light"] .aton-reply-compose {
  background: #eef6ff;
  border-color: rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .aton-reply-compose-label {
  color: #2563eb;
}

[data-theme="light"] .aton-reply-compose-text {
  color: #334155;
}

[data-theme="light"] .aton-reply-compose-close {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

[data-theme="light"] .aton-reply-compose-close:hover {
  background: rgba(248, 113, 113, 0.22);
  color: #991b1b;
}

[data-theme="light"] .aton-voice-preview {
  background: rgba(219, 234, 254, 0.95);
  border-color: rgba(37, 99, 235, 0.28);
}

[data-theme="light"] .aton-voice-preview-label {
  color: #1a1a2e;
}

[data-theme="light"] .aton-voice-preview-time {
  color: #4b5563;
}

[data-theme="light"] .aton-voice-preview-play {
  background: #ffffff;
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.22);
}

[data-theme="light"] .aton-voice-preview-cancel {
  background: #f3f4f6;
  color: #374151;
}

[data-theme="light"] .aton-voice-preview-send {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
}

[data-theme="light"] .aton-input {
  background: #ffffff !important;
  color: #1a1a2e !important;
  border-color: rgba(0, 0, 0, 0.12);
  -webkit-text-fill-color: #1a1a2e;
}

[data-theme="light"] .aton-input:-webkit-autofill,
[data-theme="light"] .aton-input:-webkit-autofill:hover,
[data-theme="light"] .aton-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1a1a2e !important;
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .aton-input:focus {
  border-color: #c27803;
  box-shadow: 0 0 0 3px rgba(194, 120, 3, 0.1);
}

[data-theme="light"] .aton-search-input {
  background: #f4f6f8;
  color: #1a1a2e;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .aton-user-pill {
  background: #f4f6f8;
  border-color: rgba(0, 0, 0, 0.08);
  color: #1a1a2e;
}

[data-theme="light"] .aton-chat-menu-btn {
  color: #9ca3af;
}

[data-theme="light"] .aton-chat-unread-badge {
  background: #2563eb;
}

[data-theme="light"] .aton-search-item {
  color: #1a1a2e;
  background: #f4f6f8;
}

[data-theme="light"] .aton-search-item:hover {
  background: #e8ecf4;
}

[data-theme="light"] .aton-search-section-title {
  color: #64748b;
}

[data-theme="light"] .aton-search-item--user {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .aton-search-item--user:hover {
  background: #eef2ff;
  border-color: rgba(37, 99, 235, 0.25);
}

[data-theme="light"] .aton-search-user-main:hover {
  background: rgba(37, 99, 235, 0.06);
}

[data-theme="light"] .aton-search-avatar {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-search-action {
  background: #f4f6f8;
  color: #374151;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .aton-search-action:hover:not(:disabled) {
  background: #e8ecf4;
  color: #1a1a2e;
}

[data-theme="light"] .aton-search-write {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  border-color: rgba(37, 99, 235, 0.45);
}

[data-theme="light"] .aton-search-write:hover:not(:disabled) {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff !important;
}

[data-theme="light"] .aton-search-add {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.28);
}

[data-theme="light"] .aton-search-add:hover:not(:disabled) {
  background: #dbeafe;
  color: #1e40af;
}

[data-theme="light"] .aton-search-block {
  background: #fef2f2;
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.35);
}

[data-theme="light"] .aton-search-block:hover:not(:disabled) {
  background: #fee2e2;
  color: #991b1b;
}

[data-theme="light"] .aton-search-join {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.28);
}

[data-theme="light"] .aton-search-join:hover:not(:disabled) {
  background: #dbeafe;
  color: #1e40af;
}

[data-theme="light"] .aton-peer-action-bar {
  background: #f8fafc;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-peer-btn {
  background: #f4f6f8;
  color: #374151;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .aton-peer-rename-local {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.28);
}

[data-theme="light"] .aton-peer-rename-local:hover {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.42);
  color: #1e3a8a;
}

[data-theme="light"] .aton-peer-alias-modal {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .aton-peer-alias-heading {
  color: #1a1a2e;
}

[data-theme="light"] .aton-peer-alias-lead {
  color: #6b7280;
}

[data-theme="light"] .aton-peer-alias-footnote {
  color: #9ca3af;
}

[data-theme="light"] .aton-peer-alias-backdrop {
  background: rgba(15, 23, 42, 0.4);
}

[data-theme="light"] .aton-friends-panel {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .aton-friends-row {
  background: #f4f6f8;
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-friends-hint {
  color: #6b7280;
}

[data-theme="light"] .aton-chat-verify-menu {
  background: #f4f6f8;
  color: #1a1a2e;
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-chat-verify-menu:hover:not(:disabled) {
  background: #e0e7ff;
  color: #2563eb;
}

[data-theme="light"] .aton-chat-onboarding-card {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-chat-onboarding-title {
  color: #1a1a2e;
}

[data-theme="light"] .aton-chat-onboarding-desc {
  color: #6b7280;
}

[data-theme="light"] .aton-verify-screen {
  background: #ffffff;
}

[data-theme="light"] .aton-verify-card {
  background: #ffffff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-verify-card h2 {
  color: #c27803;
}

[data-theme="light"] .aton-verify-card p {
  color: #374151;
}

[data-theme="light"] .aton-primary-button {
  background: linear-gradient(135deg, #c27803, #d4590c);
  color: #ffffff;
}

[data-theme="light"] .aton-onboarding-cta-primary {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="light"] .aton-onboarding-cta-secondary {
  background: #ffffff;
  color: #1a1a2e;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .aton-onboarding-cta-secondary:hover {
  background: #f0f4ff;
}

[data-theme="light"] .aton-verified-badge {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
  color: #2563eb;
}

[data-theme="light"] .aton-chat-verified-badge {
  color: #2563eb;
}

[data-theme="light"] .aton-empty-title {
  color: #1a1a2e;
}

[data-theme="light"] .aton-empty-lead,
[data-theme="light"] .aton-empty-subtitle {
  color: #6b7280;
}

[data-theme="light"] .aton-empty-icon {
  color: #2563eb;
}

[data-theme="light"] .aton-chat-onboarding-icon {
  color: #2563eb;
}

[data-theme="light"] .aton-profile-link {
  color: #6b7280;
  border-top-color: var(--aton-border-soft);
}

[data-theme="light"] .aton-profile-link:hover {
  color: #2563eb;
}

[data-theme="light"] .aton-profile-page {
  background: #ffffff;
}

[data-theme="light"] .aton-profile-page-scroll {
  scrollbar-color: #cbd5e1 #f8fafc;
}

[data-theme="light"] .aton-profile-page-scroll::-webkit-scrollbar-track {
  background: #f8fafc;
}

[data-theme="light"] .aton-profile-page-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-color: #f8fafc;
}

[data-theme="light"] .aton-profile-page-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

[data-theme="light"] .aton-profile-hero,
[data-theme="light"] .aton-profile-form {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .aton-profile-hero h1 {
  color: #0f172a;
}

[data-theme="light"] .aton-profile-public-id,
[data-theme="light"] .aton-profile-help {
  color: #64748b;
}

[data-theme="light"] .aton-profile-section-title {
  color: #0f172a;
}

[data-theme="light"] .aton-profile-verify-pill,
[data-theme="light"] .aton-profile-email-pill {
  background: #ffffff;
  color: #475569;
  border-color: rgba(148, 163, 184, 0.28);
}

[data-theme="light"] .aton-profile-verify-pill span {
  background: #e2e8f0;
  color: #64748b;
}

[data-theme="light"] .aton-profile-verify-pill.is-verified {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .aton-profile-verify-pill.is-verified span {
  background: rgba(37, 99, 235, 0.14);
  color: #2563eb;
}

[data-theme="light"] .aton-profile-field .aton-input[readonly] {
  background: #eef2f7;
  color: #64748b;
}

[data-theme="light"] .aton-profile-lang-btn {
  background: #ffffff;
  color: #111827;
  border-color: rgba(15, 23, 42, 0.14);
}

[data-theme="light"] .aton-profile-lang-btn:hover {
  background: #f8fafc;
  border-color: rgba(37, 99, 235, 0.24);
}

[data-theme="light"] .aton-profile-lang-btn.active {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.38);
}

[data-theme="light"] .aton-profile-actions .aton-new-chat-button {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.18);
  color: #2563eb;
}

[data-theme="light"] .aton-profile-actions .aton-new-chat-button:hover {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
}

[data-theme="light"] .aton-profile-actions .aton-profile-logout-button {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.18);
  color: #dc2626;
}

[data-theme="light"] .aton-profile-actions .aton-profile-logout-button:hover {
  background: rgba(220, 38, 38, 0.14);
  color: #b91c1c;
}

[data-theme="light"] .aton-profile-back {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}

[data-theme="light"] .aton-profile-mobile-back {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
  color: #2563eb;
}

[data-theme="light"] .aton-profile-back:hover,
[data-theme="light"] .aton-profile-mobile-back:hover,
[data-theme="light"] .aton-profile-avatar-upload:hover {
  background: rgba(37, 99, 235, 0.14);
}

[data-theme="light"] .aton-profile-avatar-upload {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}

[data-theme="light"] .aton-send-button {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="light"] .aton-send-button:hover {
  background: #1d4ed8;
}

[data-theme="light"] .aton-mic-button,
[data-theme="light"] .aton-attach-button {
  background: #f0f2f5;
  color: #6b7280;
}

[data-theme="light"] .aton-mic-button:hover,
[data-theme="light"] .aton-attach-button:hover {
  background: #e5e7eb;
  color: #374151;
}

[data-theme="light"] .aton-compose--golos .aton-mic-button,
[data-theme="light"] .aton-compose--golos .aton-attach-button {
  color: #0c4a6e;
  background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .aton-compose--golos .aton-mic-button:hover,
[data-theme="light"] .aton-compose--golos .aton-attach-button:hover {
  background: linear-gradient(145deg, #bae6fd 0%, #7dd3fc 100%);
  color: #0a3d5c;
}

[data-theme="light"] .aton-message-avatar {
  background: linear-gradient(135deg, #e0e7ff, #dbeafe);
  color: #3b82f6;
}

[data-theme="light"] .aton-auth-tabs {
  background: #f0f0f3;
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-auth-tab {
  color: #6b7280;
}

[data-theme="light"] .aton-auth-tab.active {
  background: #ffffff;
  color: #1a1a2e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .aton-input-label {
  color: #4b5563;
}

[data-theme="light"] .aton-auth-hint {
  color: #6b7280;
}

[data-theme="light"] .aton-auth-link,
[data-theme="light"] .aton-auth-footer a {
  color: #2563eb;
}

[data-theme="light"] .aton-primary-button {
  background: linear-gradient(135deg, #c27803, #d4590c);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(194, 120, 3, 0.2);
}

[data-theme="light"] .aton-empty-kicker {
  color: #c27803;
}

[data-theme="light"] .aton-main {
  background: #ffffff;
}

/* ===== ANIMATIONS ===== */
.aton-chat-item {
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.2s ease;
}

.aton-main {
  transition: opacity 0.2s ease;
}

.aton-sidebar,
.aton-topbar,
.aton-compose,
.aton-messages,
.aton-chat-item,
.aton-message-bubble,
.aton-input,
.aton-search-input,
.aton-compose-input,
.aton-compose-row {
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 840px) {
  /* ===== LAYOUT ===== */
  /* 100vh должен идти первым (fallback), 100dvh — последним, иначе vh перебивает dvh
     и на мобиле обрезается шапка или панель ввода (адресная строка / safe area). */
  html,
  body,
  #app {
    min-height: -webkit-fill-available;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .aton-shell {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .aton-sidebar {
    width: 100%;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .aton-sidebar-toolbar:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    border: none;
    align-self: center;
  }

  /* Гость: main скрыт — тема только здесь; !important на случай конфликта с базовым display:none */
  .aton-shell--guest-landing .aton-sidebar-toolbar:not([hidden]) {
    display: flex !important;
    flex: 0 0 auto;
    align-items: center;
  }

  .aton-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .aton-profile-page-scroll {
    padding: 12px 12px max(18px, env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .aton-profile-hero,
  .aton-profile-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 14px;
    padding: 16px;
  }

  .aton-profile-mobile-nav {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    padding: 0 0 10px;
    background: linear-gradient(180deg, var(--aton-bg) 0%, var(--aton-bg) calc(100% - 10px), transparent 100%);
  }

  .aton-profile-mobile-back {
    width: 100%;
  }

  .aton-profile-hero-main {
    align-items: flex-start;
    gap: 14px;
  }

  .aton-profile-avatar-large {
    width: 72px;
    height: 72px;
    font-size: 30px;
  }

  .aton-profile-hero h1 {
    font-size: 22px;
  }

  .aton-profile-public-id {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .aton-profile-status-row {
    gap: 6px;
  }

  .aton-profile-language-options {
    flex-direction: column;
  }

  .aton-profile-lang-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .aton-profile-lang-btn span:last-child,
  .aton-profile-help,
  .aton-input {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .aton-profile-verify-pill,
  .aton-profile-email-pill {
    max-width: 100%;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .aton-profile-back {
    display: none !important;
  }

  .aton-profile-actions {
    flex-direction: column;
  }

  .aton-profile-actions .aton-new-chat-button,
  .aton-profile-actions .aton-profile-logout-button,
  .aton-profile-actions .aton-primary-button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .aton-profile-actions .aton-primary-button {
    order: 1;
  }

  .aton-profile-actions .aton-new-chat-button {
    order: 2;
  }

  .aton-profile-actions .aton-profile-logout-button {
    order: 3;
  }

  /* ===== GUEST LANDING ===== */
  .aton-shell--guest-landing .aton-main {
    display: none !important;
  }

  .aton-shell--guest-landing .aton-sidebar {
    flex: 1;
    min-height: 100vh;
    min-height: 100dvh;
    border-bottom: none;
  }

  .aton-shell--guest-landing .aton-sidebar-header {
    flex-shrink: 0;
    padding: 20px 20px 12px;
  }

  .aton-shell--guest-landing .aton-auth {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    border-bottom: none;
    padding: 16px 20px max(20px, env(safe-area-inset-bottom));
  }

  .aton-shell--guest-landing .aton-auth-lang {
    display: flex;
  }

  .aton-shell--guest-landing .aton-sidebar-lang-footer {
    display: none;
  }

  /* Гость: скрыть чаты, поиск, профиль — показать только auth */
  .aton-shell--guest-landing .aton-chats,
  .aton-shell--guest-landing .aton-profile-link {
    display: none !important;
  }

  /* Нет выбранного чата — sidebar на весь экран, main скрыт */
  .aton-shell--no-chat .aton-main {
    display: none !important;
  }

  .aton-shell--profile .aton-main {
    display: flex !important;
    flex: 1;
    min-height: 0;
  }

  .aton-shell--profile .aton-sidebar {
    display: none !important;
  }

  .aton-shell--profile .aton-topbar {
    justify-content: flex-end;
    overflow: hidden;
  }

  .aton-shell--profile .aton-topbar-left {
    display: none !important;
  }

  .aton-shell--profile .aton-topbar-right {
    width: 100%;
    justify-content: flex-end;
    min-width: 0;
  }

  .aton-shell--no-chat .aton-sidebar {
    flex: 1;
    border-bottom: none;
  }

  /* Чат выбран — sidebar скрыт, main на весь экран */
  .aton-shell--has-chat .aton-sidebar {
    display: none !important;
  }

  .aton-shell--has-chat .aton-main {
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  /* ===== HEADER (компактный): логотип + кнопки в одной строке ===== */
  .aton-sidebar-header {
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 10px;
    padding-top: max(16px, calc(env(safe-area-inset-top) + 8px));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .aton-logo {
    width: 28px;
    height: 28px;
  }

  .aton-title {
    font-size: 15px;
  }

  .aton-subtitle {
    font-size: 11px;
  }

  /* ===== AUTH FORM ===== */
  .aton-auth {
    padding: 14px 16px 18px;
  }

  .aton-auth-tabs {
    margin-bottom: 16px;
  }

  .aton-auth-tab {
    font-size: 13px;
    padding: 11px 16px;
    min-height: 44px;
  }

  .aton-input-label {
    font-size: 12px;
  }

  .aton-input {
    font-size: 16px;
    padding: 13px 14px;
    min-height: 48px;
    border-radius: 14px;
  }

  .aton-primary-button {
    font-size: 16px;
    padding: 15px 20px;
    min-height: 52px;
    border-radius: 14px;
  }

  .aton-auth-hint {
    font-size: 13px;
    margin-top: 6px;
  }

  .aton-auth-link {
    font-size: 13px;
  }

  /* ===== CHATS SECTION ===== */
  .aton-chats {
    padding: 8px 8px 12px;
    gap: 6px;
  }

  .aton-chats-header {
    font-size: 11px;
    padding: 2px 6px 2px 10px;
    min-height: 34px;
    align-items: center;
  }

  .aton-new-chat-button {
    font-size: 11px;
    padding: 6px 14px;
    min-height: 32px;
  }

  .aton-create-group-button {
    min-height: 30px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 12px;
  }

  .aton-create-chat-overlay {
    align-items: flex-end;
    padding: 12px;
  }

  .aton-create-chat-panel {
    width: 100%;
    padding: 18px;
    border-radius: 18px;
  }

  .aton-create-chat-title {
    font-size: 18px;
  }

  .aton-create-chat-actions {
    flex-direction: column-reverse;
  }

  .aton-create-chat-secondary,
  .aton-create-chat-primary {
    width: 100%;
  }

  /* ===== SEARCH ===== */
  .aton-search {
    padding: 0 0 6px;
  }

  .aton-search-input {
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px;
    border-radius: 14px;
  }

  .aton-search-results {
    max-height: 280px;
  }

  .aton-search-item {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 44px;
    border-radius: 12px;
  }

  .aton-search-item--user {
    min-height: 0;
    padding: 0;
  }

  .aton-search-user-card {
    padding: 12px 14px;
    gap: 12px;
  }

  .aton-search-avatar {
    width: 44px;
    height: 44px;
  }

  .aton-search-item--user .aton-search-actions {
    gap: 10px;
  }

  .aton-search-action {
    font-size: 11px;
    padding: 5px 12px;
    min-height: 32px;
    border-radius: 8px;
  }

  /* ===== ONBOARDING ===== */
  .aton-chat-onboarding {
    padding: 4px 8px 8px;
  }

  .aton-chat-onboarding-card {
    padding: 10px 12px;
    border-radius: 14px;
  }

  .aton-chat-onboarding-title {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .aton-chat-onboarding-desc {
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 8px;
  }

  .aton-onboarding-cta {
    padding: 7px 14px;
    font-size: 11px;
    min-height: 34px;
  }

  /* ===== CHAT LIST ITEMS ===== */
  .aton-chat-item {
    padding: 10px 12px;
    gap: 10px;
    min-height: 56px;
    border-bottom-color: rgba(31, 41, 55, 0.5);
  }

  .aton-chat-avatar {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .aton-chat-item-title {
    font-size: 14px;
    font-weight: 600;
  }

  .aton-chat-item-subtitle {
    font-size: 12px;
    margin-top: 2px;
  }

  .aton-chat-menu-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
    opacity: 1;
    pointer-events: auto;
  }

  .aton-chat-item-delete {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .aton-chat-verify-menu {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .aton-chat-unread-badge {
    min-width: 22px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .aton-chat-time {
    font-size: 11px;
  }

  .aton-chat-online-dot {
    width: 8px;
    height: 8px;
  }

  .aton-chat-verified-badge {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  /* ===== TOPBAR ===== */
  .aton-topbar {
    min-height: 52px;
    height: auto;
    padding: max(12px, calc(env(safe-area-inset-top) + 6px)) 12px 8px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 6px;
  }

  .aton-topbar-left {
    min-width: 0;
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .aton-shell--has-chat .aton-back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin-left: -4px;
  }

  .aton-topbar-info {
    min-width: 0;
    flex: 1;
  }

  .aton-topbar-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .aton-topbar-title-inner {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .aton-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .aton-topbar-status {
    font-size: 11px;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
    max-width: 100%;
  }

  .aton-topbar--guest .aton-topbar-title {
    font-size: 16px;
  }

  .aton-topbar--guest .aton-topbar-status {
    max-width: none;
  }

  .aton-topbar-icon {
    padding: 8px 10px;
    font-size: 16px;
    min-width: 36px;
    min-height: 36px;
  }

  /* Внутри чата на мобиле — прячем лишние кнопки */
  .aton-shell--has-chat .aton-topbar-right .aton-user-pill {
    display: none !important;
  }

  .aton-shell--has-chat .aton-topbar-right {
    gap: 4px;
    flex-shrink: 0;
  }

  /* User pill скрыт — имя уже показано в auth-bar */
  .aton-user-pill {
    display: none;
  }

  .aton-user-avatar {
    width: 24px;
    height: 24px;
  }

  .aton-verified-badge {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  /* ===== MESSAGES AREA ===== */
  .aton-chat {
    padding: 8px 10px 10px;
    gap: 6px;
  }

  /* safe-area снизу только у .aton-compose, иначе дублирование съедает высоту на коротких экранах */
  .aton-messages {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    padding-bottom: 8px;
    gap: 10px;
  }

  .aton-message-avatar {
    width: 28px;
    height: 28px;
  }

  .aton-message-bubble {
    display: block;
    flex: 0 1 auto;
    width: max-content;
    max-width: min(96%, 1000px);
    min-width: 0;
    padding: 10px 14px 8px;
    border-radius: 16px 16px 16px 6px;
    font-size: 15px;
    line-height: 1.45;
  }

  .aton-message-bubble.self {
    border-radius: 16px 16px 6px 16px;
  }

  /* иначе правило .aton-message-bubble { width: max-content } выше в этом @media снова сжимает голос */
  .aton-message-bubble--voice {
    width: min(360px, 58%);
    max-width: min(360px, 58%);
    min-width: 0;
    box-sizing: border-box;
  }

  .aton-message-bubble--voice:has(.aton-message-text-body) {
    width: max-content;
    max-width: min(85%, 1080px);
  }

  .aton-message-row--private-dm .aton-message-bubble--voice:has(.aton-message-text-body) {
    max-width: min(85%, 1080px);
  }

  .aton-message-text--media {
    width: min(260px, calc(100vw - 72px));
    max-width: min(260px, 90vw);
  }

  .aton-message-text--media.aton-message-text--voice {
    width: 100%;
    max-width: 100%;
  }

  .aton-message-time {
    font-size: 11px;
  }

  .aton-message-actions {
    opacity: 0.72;
  }

  .aton-message-actions:focus-within,
  .aton-message-bubble:active .aton-message-actions {
    opacity: 1;
  }

  .aton-message-action-button {
    font-size: 13px;
    padding: 0 8px;
    min-width: 30px;
    height: 30px;
  }

  .aton-message-reply-preview {
    font-size: 12px;
    padding: 5px 8px;
  }

  .aton-message-reactions {
    gap: 5px;
  }

  .aton-reaction-pill {
    height: 34px;
    padding: 0 11px 0 9px;
  }

  .aton-reaction-picker {
    padding: 8px;
    gap: 5px;
    border-radius: 18px;
    max-width: calc(100vw - 16px);
  }

  .aton-reaction-picker-list {
    grid-template-columns: repeat(4, 47px);
    gap: 5px;
  }

  .aton-reaction-picker-item {
    font-size: 26px;
    width: 47px;
    height: 47px;
    border-radius: 13px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .aton-message-image {
    border-radius: 12px;
    max-height: 260px;
  }

  .aton-golos-voice-bar {
    margin: 0;
    border-radius: 12px 12px 0 0;
  }
  .aton-golos-voice-bar-inner {
    grid-template-columns: 1fr;
    padding: 10px 12px 10px;
    gap: 10px;
  }
  .aton-golos-voice-bar-sub {
    max-width: none;
  }
  .aton-golos-voice-cta {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* ===== COMPOSE ===== */
  .aton-compose {
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .aton-reply-compose {
    grid-template-columns: 3px minmax(0, 1fr) 36px;
    padding: 8px 9px;
    border-radius: 12px;
  }

  .aton-reply-compose-label {
    font-size: 12px;
  }

  .aton-reply-compose-text {
    font-size: 13px;
  }

  .aton-reply-compose-close {
    width: 36px;
    height: 36px;
  }

  .aton-compose-input {
    font-size: 16px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 20px;
    line-height: 1.4;
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
  }

  .aton-compose--golos .aton-compose-input {
    width: 100% !important;
    min-width: 0;
  }

  .aton-compose-actions {
    gap: 2px;
  }

  .aton-send-button {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
  }

  .aton-send-icon {
    display: block !important;
  }

  .aton-send-text {
    display: none;
  }

  .aton-mic-button,
  .aton-attach-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .aton-typing-indicator {
    font-size: 12px;
    margin-left: 8px;
  }

  /* ===== EMPTY STATES ===== */
  .aton-empty-title {
    font-size: 20px;
  }

  .aton-empty-lead {
    font-size: 14px;
  }

  .aton-empty-subtitle {
    font-size: 14px;
  }

  /* ===== LIGHTBOX ===== */
  .aton-image-lightbox img {
    max-width: 96vw;
    max-height: 88vh;
    border-radius: 12px;
  }

  .aton-image-lightbox-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .aton-image-lightbox-nav {
    width: 44px;
    height: 58px;
    border-radius: 14px;
    font-size: 38px;
  }

  .aton-image-lightbox-nav--prev {
    left: 10px;
  }

  .aton-image-lightbox-nav--next {
    right: 10px;
  }

  /* ===== MENUS / DROPDOWNS ===== */
  .aton-chat-menu-dropdown {
    border-radius: 16px;
    padding: 8px;
    min-width: 200px;
  }

  .aton-chat-menu-item {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 12px;
    min-height: 44px;
  }

  /* После общих правил .aton-topbar-icon: одинаковые круги для друзей/темы на главной */
  .aton-sidebar-toolbar .aton-topbar-icon {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    margin: 0;
    box-sizing: border-box;
    line-height: 0;
    font-size: 0;
  }

  .aton-sidebar-toolbar .aton-topbar-icon svg {
    display: block;
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
  }
}
