* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root,
[data-theme="dark"] {
  --aton-bg: #020617;
  --aton-bg-elevated: #02081b;
  --aton-bg-soft: #0b1120;
  --aton-border-soft: rgba(148, 163, 184, 0.25);
  --aton-text-main: #f9fafb;
  --aton-text-muted: #9ca3af;
  --aton-accent-gold: #fbbf24;
  --aton-accent-amber: #fb923c;
  --aton-accent-blue: #38bdf8;
  --aton-accent-blue-deep: #0ea5e9;
  --aton-error: #f97373;
  --aton-panel: rgba(2, 6, 23, 0.85);
  --aton-sidebar-bg: rgba(2, 8, 27, 0.75);
  --aton-msg-own: rgba(56, 189, 248, 0.1);
  --aton-msg-other: rgba(30, 41, 59, 0.6);
}

[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;
}

html,
body {
  width: 100%;
  height: 100%;
  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:
    radial-gradient(circle at top left, rgba(248, 181, 81, 0.28) 0, transparent 55%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.22) 0, transparent 60%),
    linear-gradient(145deg, var(--aton-bg), var(--aton-bg) 40%, #02011a 100%);
}

[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:
    radial-gradient(circle at top left, rgba(148, 163, 253, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.24), transparent 55%),
    rgba(10, 12, 24, 0.96);
  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: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  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-toolbar {
  display: none;
}

.aton-logo {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: conic-gradient(from 200deg, #f97316, #fde68a, #22d3ee, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.8);
}

.aton-logo-inner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at top, #fee2b3, #f97316 60%, #7c2d12 100%);
}

.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-auth-logged {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.9);
  font-size: 12px;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.aton-auth-logged-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aton-auth-logged-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 2px solid rgba(56, 189, 248, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
  overflow: hidden;
}

.aton-auth-logged-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aton-auth-logged-info {
  flex: 1;
  min-width: 0;
}

.aton-auth-logged-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--aton-text);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.aton-logged-id {
  font-weight: 400;
  font-size: 11px;
  color: var(--aton-text-muted);
  opacity: 0.7;
}

.aton-auth-logged-status {
  font-size: 11px;
  color: var(--aton-accent, #38bdf8);
  margin-top: 1px;
}

.aton-logout-button {
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.2);
  padding: 0;
  width: 32px;
  height: 32px;
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease-out, color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.aton-logout-button:hover {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.3);
}

.aton-chats {
  padding: 6px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
}

.aton-chats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--aton-text-muted);
  padding: 0 8px;
}

.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-search {
  margin-top: 4px;
  padding: 0 4px 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-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-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: 2px 0;
  border-radius: 10px;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}

.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 {
  border-radius: 0;
  border: none;
  padding: 6px 10px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s ease-out;
  border-bottom: 1px solid rgba(15, 23, 42, 0.95);
}

.aton-chat-item-title {
  font-size: 13px;
  font-weight: 500;
}

.aton-chat-item-subtitle {
  font-size: 10px;
  color: var(--aton-text-muted);
}

.aton-chat-item.active {
  background: radial-gradient(circle at left, rgba(56, 189, 248, 0.22), transparent 60%);
}

.aton-chat-item:not(.active):hover {
  background: rgba(15, 23, 42, 0.95);
}

.aton-chat-item-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.aton-chat-pin {
  font-size: 11px;
  color: #fbbf24;
  margin-left: 4px;
}

.aton-chat-item-title-text {
  display: inline-flex;
  align-items: center;
}

.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: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.95);
  color: #020617;
  font-size: 10px;
  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;
}

.aton-chat-time {
  font-size: 10px;
  color: var(--aton-text-muted);
}

.aton-chat-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: 13px;
  color: #111827;
}

.aton-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.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-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.aton-topbar {
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  min-height: 52px;
  height: auto;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  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;
}

.aton-topbar-left {
  display: flex;
  flex-direction: column;
}

.aton-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.aton-topbar-title {
  font-size: 14px;
  font-weight: 500;
}

.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: 11px;
  color: var(--aton-text-muted);
  line-height: 1.35;
  max-width: min(100%, 42ch);
  word-wrap: break-word;
}

.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-status {
  max-width: 220px;
}

.aton-topbar-icon {
  position: relative;
  border: none;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.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 {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 14px;
  gap: 8px;
  overflow: hidden;
}

.aton-messages {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aton-message-row {
  display: flex;
}

.aton-message-row.self {
  justify-content: flex-end;
}

.aton-message-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.aton-message-row.self .aton-message-inner {
  flex-direction: row-reverse;
}

.aton-message-avatar {
  width: 22px;
  height: 22px;
  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: 10px;
  font-weight: 600;
  color: #fff;
}

.aton-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.aton-message-bubble {
  flex: 0 0 auto;
  flex-shrink: 0;
  /* inline-flex даёт ширину по max-content дочерних блоков; flex + fit-content давали узкую колонку и переносы */
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  vertical-align: bottom;
  max-width: min(92%, 680px);
  min-width: 0;
  padding: 10px 16px 8px;
  border-radius: 16px 16px 16px 6px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: normal;
  background: #2b3039;
  border: none;
  color: #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.aton-message-text {
  text-align: left;
  overflow-wrap: break-word;
  word-break: normal;
  max-width: 100%;
}

/* Строка текста не растягивается на всю «ошибочно» узкую ширину родителя */
.aton-message-text-body {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  vertical-align: top;
}

.aton-message-text--media {
  min-width: 0;
  width: min(360px, 100%);
  max-width: min(360px, calc(100vw - 56px));
}

/* Скрытый 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%;
  border-radius: 10px;
  margin: 8px 0 6px;
}

.aton-message-bubble.self {
  background: linear-gradient(155deg, #f59e0b 0%, #fbbf24 45%, #fde68a 100%);
  color: #1c1917;
  border-color: transparent;
  border-radius: 16px 16px 6px 16px;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.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);
}

@keyframes aton-message-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aton-message-bubble-enter {
  animation: aton-message-enter 0.18s ease-out;
}

.aton-message-meta {
  text-align: right;
  margin-top: 1px;
}

.aton-message-time {
  font-size: 11px;
  opacity: 0.5;
  white-space: nowrap;
}

.aton-message-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.aton-message-bubble:hover .aton-message-actions,
.aton-message-actions:focus-within {
  opacity: 1;
}

.aton-message-action-button {
  border: none;
  background: transparent;
  color: rgba(148, 163, 184, 0.9);
  cursor: pointer;
  font-size: 11px;
  border-radius: 999px;
  padding: 0 5px;
}

.aton-message-action-button:hover {
  background: rgba(15, 23, 42, 0.95);
  color: #f97316;
}

.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;
  opacity: 0.8;
  padding: 4px 6px;
  margin-bottom: 4px;
  border-left: 2px solid rgba(248, 181, 81, 0.8);
}

.aton-message-reactions {
  margin-top: 4px;
  display: inline-flex;
  gap: 4px;
}

.aton-reaction-pill {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(55, 65, 81, 0.9);
  font-size: 11px;
}

.aton-reaction-picker {
  z-index: 80;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(55, 65, 81, 0.9);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
  display: inline-flex;
  gap: 2px;
}

.aton-reaction-picker-item {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
}

.aton-reaction-picker-item:hover {
  transform: translateY(-1px);
}

.aton-compose {
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.aton-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}

.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-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: 38px;
  max-height: min(40vh, 200px);
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 13px;
  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;
}

.aton-compose-input:focus {
  outline: none;
  border-color: var(--aton-accent-blue);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.aton-send-button {
  border-radius: 999px;
  border: none;
  padding: 7px 11px;
  background: radial-gradient(circle at top, var(--aton-accent-blue), var(--aton-accent-blue-deep));
  color: #020617;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.aton-send-icon {
  display: none;
}

.aton-send-button:hover {
  filter: brightness(1.05);
}

.aton-mic-button,
.aton-attach-button {
  border-radius: 999px;
  border: none;
  padding: 6px;
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aton-mic-button:hover,
.aton-attach-button:hover {
  background: rgba(17, 24, 39, 0.95);
}

.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-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-sun {
  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-sun {
    display: block;
    position: relative;
    width: clamp(120px, 16vw, 220px);
    height: clamp(120px, 16vw, 220px);
    margin: 0 auto 28px;
    flex-shrink: 0;
    border-radius: 50%;
    background: conic-gradient(from 200deg, #f97316, #fde68a, #22d3ee, #f97316);
    box-shadow:
      0 0 48px rgba(251, 191, 36, 0.55),
      0 0 96px rgba(251, 146, 60, 0.22),
      inset 0 0 32px rgba(254, 226, 179, 0.12);
  }

  .aton-landing-sun::after {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #fee2b3, #f97316 58%, #7c2d12 100%);
    box-shadow: inset 0 0 24px rgba(124, 45, 18, 0.35);
  }
}

@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;
  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 {
  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-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-logo-inner {
  filter: brightness(0.85);
}

[data-theme="light"] .aton-title {
  color: #1a1a2e;
}

[data-theme="light"] .aton-subtitle {
  color: #6b7280;
}

[data-theme="light"] .aton-auth-logged {
  border-bottom-color: var(--aton-border-soft);
}

[data-theme="light"] .aton-auth-logged-avatar {
  background: linear-gradient(135deg, #e0e7ff, #dbeafe);
  border-color: rgba(37, 99, 235, 0.2);
  color: #3b82f6;
}

[data-theme="light"] .aton-auth-logged-user {
  color: #1a1a2e;
}

[data-theme="light"] .aton-auth-logged-status {
  color: #2563eb;
}

[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-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;
}

[data-theme="light"] .aton-chat-avatar {
  background: linear-gradient(135deg, #e0e7ff, #dbeafe);
  border-color: rgba(37, 99, 235, 0.15);
  color: #3b82f6;
}

[data-theme="light"] .aton-chat-item-title {
  color: #1a1a2e;
}

[data-theme="light"] .aton-chat-item-preview {
  color: #6b7280;
}

[data-theme="light"] .aton-message-bubble {
  background: #f0f2f5;
  color: #1a1a2e;
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .aton-message-bubble.self {
  background: #dcf8c6;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

[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-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-compose {
  background: #ffffff;
  border-top: 1px solid var(--aton-border-soft);
}

[data-theme="light"] .aton-compose-input {
  background: #f4f6f8;
  color: #1a1a2e;
  border-color: rgba(0, 0, 0, 0.08);
}

[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-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-topbar-icon {
  background: #f4f6f8;
  color: #6b7280;
}

[data-theme="light"] .aton-topbar-icon:hover {
  background: #e0e7ff;
  color: #2563eb;
}

[data-theme="light"] .aton-topbar-icon.active {
  background: #2563eb;
  color: #ffffff;
}

[data-theme="light"] .aton-user-pill {
  background: #f4f6f8;
  border-color: rgba(0, 0, 0, 0.08);
  color: #1a1a2e;
}

[data-theme="light"] .aton-chat-item {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}

[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-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-logout-button {
  background: rgba(220, 38, 38, 0.05);
  border-color: rgba(220, 38, 38, 0.12);
  color: #ef4444;
}

[data-theme="light"] .aton-logout-button:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

[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-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-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-landing-sun {
  filter: saturate(0.8);
}

[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-message-inner {
  animation: aton-msg-in 0.25s ease-out;
}

@keyframes aton-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aton-main {
  transition: opacity 0.2s ease;
}

.aton-sidebar,
.aton-topbar,
.aton-compose,
.aton-messages,
.aton-auth-logged,
.aton-chat-item,
.aton-message-bubble,
.aton-input,
.aton-search-input,
.aton-compose-input {
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

@media (max-width: 840px) {
  /* ===== LAYOUT ===== */
  html, body, #app {
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
  }

  .aton-shell {
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    max-height: 100dvh;
    max-height: 100vh;
    overflow: hidden;
  }

  .aton-sidebar {
    width: 100%;
    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: 4px 12px 10px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    flex-shrink: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .aton-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* ===== GUEST LANDING ===== */
  .aton-shell--guest-landing .aton-main {
    display: none !important;
  }

  .aton-shell--guest-landing .aton-sidebar {
    flex: 1;
    min-height: 100dvh;
    min-height: 100vh;
    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));
  }

  /* Гость: скрыть чаты, поиск, профиль — показать только 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--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 {
    padding: 12px 16px 6px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .aton-logo {
    width: 28px;
    height: 28px;
  }

  .aton-logo-inner {
    width: 18px;
    height: 18px;
  }

  .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;
  }

  /* ===== AUTH LOGGED BAR ===== */
  .aton-auth-logged {
    padding: 10px 16px;
  }

  .aton-auth-logged-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .aton-auth-logged-user {
    font-size: 14px;
  }

  .aton-logout-button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* ===== CHATS SECTION ===== */
  .aton-chats {
    padding: 8px 8px 12px;
    gap: 6px;
  }

  .aton-chats-header {
    font-size: 11px;
    padding: 0 8px;
    min-height: 36px;
    align-items: center;
  }

  .aton-new-chat-button {
    font-size: 11px;
    padding: 6px 14px;
    min-height: 32px;
  }

  /* ===== SEARCH ===== */
  .aton-search {
    padding: 0 4px 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;
  }

  /* ===== PROFILE LINK — скрыт на мобильном (доступен через user pill) ===== */
  .aton-profile-link {
    display: none;
  }

  /* ===== TOPBAR ===== */
  .aton-topbar {
    min-height: 52px;
    height: auto;
    padding: max(8px, env(safe-area-inset-top)) 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-filter-private,
  .aton-shell--has-chat .aton-topbar-right #aton-filter-group,
  .aton-shell--has-chat .aton-topbar-right #aton-moderation,
  .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;
  }

  .aton-messages {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  .aton-message-avatar {
    width: 28px;
    height: 28px;
  }

  .aton-message-bubble {
    flex-shrink: 0;
    display: inline-flex;
    vertical-align: bottom;
    max-width: min(92%, 680px);
    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-text--media {
    width: min(320px, calc(100vw - 72px));
    max-width: min(320px, 90vw);
  }

  .aton-message-time {
    font-size: 11px;
  }

  .aton-message-actions {
    opacity: 1;
  }

  .aton-message-action-button {
    font-size: 13px;
    padding: 2px 8px;
    min-width: 28px;
    min-height: 28px;
  }

  .aton-message-reply-preview {
    font-size: 12px;
    padding: 5px 8px;
  }

  .aton-message-reactions {
    gap: 6px;
  }

  .aton-reaction-pill {
    padding: 4px 8px;
    font-size: 13px;
  }

  .aton-reaction-picker {
    padding: 6px 8px;
    gap: 4px;
  }

  .aton-reaction-picker-item {
    font-size: 20px;
    padding: 4px 6px;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .aton-message-image {
    border-radius: 12px;
  }

  /* ===== COMPOSE ===== */
  .aton-compose {
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .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-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;
  }

  /* ===== 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;
  }
}

