/* Lux SaaS / Glassmorphism / Soft electric energy */
:root {
  --bg-0: #e8e6f8;
  --bg-1: #d9d7f2;
  --bg-2: #cfcdea;

  --ink: #3a3d5c;
  --muted: #6b6e8a;
  --muted-2: #8e90a8;

  --glass: rgba(255, 255, 255, 0.25);
  --glass-2: rgba(255, 255, 255, 0.38);
  --stroke: rgba(255, 255, 255, 0.35);
  --stroke-2: rgba(255, 255, 255, 0.55);

  --shadow: 0 16px 48px rgba(90, 70, 180, 0.14);
  --shadow-soft: 0 8px 28px rgba(90, 70, 180, 0.10);
  --glow: 0 0 0 1px rgba(255,255,255,0.40), 0 12px 36px rgba(90,70,180,0.12);
  --glow-strong: 0 0 0 1px rgba(255,255,255,0.55), 0 16px 44px rgba(90,70,180,0.18);

  --radius-lg: 26px;
  --radius-md: 18px;
  --blur: 24px;

  --accent-blue: #4c6fff;
  --accent-violet: #7a3cff;
  --accent-pink: #ff7be5;
  --accent-mint: #5ee0c6;
}

body {
  font-family: "General Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(122,60,255,0.10), transparent 55%),
    radial-gradient(800px 500px at 85% 15%, rgba(255,123,229,0.08), transparent 55%),
    radial-gradient(1000px 700px at 50% 90%, rgba(94,224,198,0.06), transparent 55%),
    linear-gradient(170deg, var(--bg-0), var(--bg-1), var(--bg-2));
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 16px 42px;
  position: relative;
}

/* ═══ Topbar ═══ */
.topbar-wrapper {
  margin-bottom: 20px;
}

.topbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-2);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow-soft);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.topbar-logo img {
  display: block;
  height: 38px;
  width: auto;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255,255,255,0.30);
  border: 1px solid rgba(255,255,255,0.45);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 4px 14px rgba(90,70,180,0.06);
  cursor: pointer;
  transition: all 220ms ease;
  position: relative;
  color: var(--ink);
  overflow: hidden;
}

.topbar-action-btn:hover {
  background: rgba(255,255,255,0.45);
  box-shadow: 0 8px 22px rgba(90,70,180,0.12);
  transform: translateY(-1px);
}

.topbar-action-icon { font-size: 15px; }
.topbar-action-text { font-size: 12px; letter-spacing: 0.01em; }

.topbar-action-exit {
  background: rgba(255,100,100,0.10);
  border-color: rgba(255,100,100,0.22);
}
.topbar-action-exit:hover {
  background: rgba(255,100,100,0.18);
}

.account-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.account-unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.85);
}

.account-unread-badge.has-unread {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* ═══ Nav Tabs ═══ */
.topbar-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 11px 22px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 520;
  letter-spacing: -0.01em;
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 6px 20px rgba(90,70,180,0.08);
  transition: all 220ms ease;
  position: relative;
  overflow: hidden;
}

.nav-tab:hover {
  background: rgba(255,255,255,0.40);
  border-color: var(--stroke-2);
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.nav-tab.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  color: #fff;
  border-color: rgba(255,255,255,0.30);
  box-shadow: 0 10px 32px rgba(76,111,255,0.28), 0 0 0 1px rgba(255,255,255,0.25);
  font-weight: 600;
}

.nav-icon { display: none; }

/* ═══ Notification Badge ═══ */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #f97316);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(239,68,68,0.35);
  animation: notif-pulse 1.5s ease-in-out infinite;
}
@keyframes notif-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 3px 10px rgba(239,68,68,0.35); }
  50% { transform: scale(1.15); box-shadow: 0 3px 14px rgba(239,68,68,0.55); }
}

/* ═══ Notifications Panel ═══ */
.notifications-panel {
  margin: 10px 0;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--glass-2);
  border: 1px solid var(--stroke-2);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  max-height: 380px;
  overflow-y: auto;
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 14px;
}

.notifications-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255,255,255,0.30);
  border: 1px solid rgba(255,255,255,0.45);
}

.notifications-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.notifications-tab:hover {
  transform: none;
  background: rgba(255,255,255,0.45);
  box-shadow: none;
}

.notifications-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  border-color: rgba(255,255,255,0.30);
}

.notifications-list { display: grid; gap: 8px; }

.notifications-empty {
  text-align: center;
  padding: 20px;
  color: var(--muted-2);
  font-size: 13px;
}

.notification-item {
  padding: 12px 14px;
  border-radius: 16px;
  background:
    radial-gradient(120% 130% at 6% -10%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.18) 44%, rgba(255,255,255,0.20) 100%);
  border: 1px solid rgba(255,255,255,0.50);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 8px 24px rgba(76,111,255,0.08);
  transition: all 220ms ease;
}

.notification-item:hover {
  transform: translateY(-1px);
  background:
    radial-gradient(120% 130% at 6% -10%, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.24) 44%, rgba(255,255,255,0.22) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.50), 0 10px 28px rgba(76,111,255,0.14);
}

.notif-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted-2);
  margin-bottom: 4px;
}

.notif-account { font-weight: 600; color: var(--accent-violet); }
.notif-chat { font-weight: 550; font-size: 13px; margin-bottom: 2px; }
.notif-text { font-size: 12px; color: var(--muted); }
.notif-open-btn {
  margin-top: 8px;
  border: 1px solid rgba(255,255,255,0.36);
  background: linear-gradient(135deg, rgba(76,111,255,0.94), rgba(122,60,255,0.92));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 180ms ease;
  box-shadow: 0 8px 20px rgba(76,111,255,0.25);
}
.notif-open-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(122,60,255,0.30);
  filter: brightness(1.05);
}

/* ═══ Toast ═══ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 520;
  max-width: 380px;
  pointer-events: auto;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 36px rgba(0,0,0,0.12);
  animation: toastSlideIn 250ms ease;
  transition: opacity 400ms ease;
}

.toast-fade { opacity: 0; }
.toast-info    { background: rgba(255,255,255,0.88); border: 1px solid rgba(90,70,180,0.20); color: var(--ink); }
.toast-warning { background: rgba(255,240,220,0.92); border: 1px solid rgba(255,170,50,0.30); color: #7a4a00; }
.toast-error   { background: rgba(255,230,230,0.92); border: 1px solid rgba(255,100,100,0.28); color: #991b1b; }
.toast-success { background: rgba(230,255,240,0.92); border: 1px solid rgba(94,224,198,0.30); color: #047857; }

@keyframes toastSlideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ═══ Protection Layout ═══ */
.prot-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.prot-layout > .card:first-child { flex: 0 0 320px; min-width: 280px; }
.prot-layout > .card:last-child  { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .prot-layout { flex-direction: column; }
  .prot-layout > .card:first-child { flex: none; width: 100%; }
}

/* ═══ Protection ═══ */
.prot-group {
  border: none;
  padding: 0;
  margin: 0 0 6px;
}
.prot-group legend {
  font-weight: 620;
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 2px;
}
.prot-cell { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.prot-cell label { font-size: 10px; margin-bottom: 0; color: var(--muted); }
.prot-cell input { margin: 1px 0 3px; padding: 5px 8px; font-size: 13px; border-radius: 10px; }

.protection-stat-card {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.28);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: 4px;
}

.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }

.stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-live-up {
  color: #10b981 !important;
  font-weight: 700;
  animation: statFlashUp 2s ease;
}
.stat-live-bad {
  color: #ef4444 !important;
  font-weight: 700;
  animation: statFlashBad 2s ease;
}
@keyframes statFlashUp {
  0% { text-shadow: 0 0 0 rgba(16,185,129,0); }
  25% { text-shadow: 0 0 16px rgba(16,185,129,0.45); transform: scale(1.06); }
  100% { text-shadow: 0 0 0 rgba(16,185,129,0); transform: scale(1); }
}
@keyframes statFlashBad {
  0% { text-shadow: 0 0 0 rgba(239,68,68,0); }
  25% { text-shadow: 0 0 16px rgba(239,68,68,0.40); transform: scale(1.06); }
  100% { text-shadow: 0 0 0 rgba(239,68,68,0); transform: scale(1); }
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 2px;
  line-height: 1.3;
}

.warmup-bar-wrap {
  width: 48px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
.warmup-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 400ms ease;
}
.warmup-pct {
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

/* Gold sparkle animation */
@keyframes sparkle-fly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}
.sparkle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd700, #ffb300);
  box-shadow: 0 0 6px 2px rgba(255,215,0,0.6);
  pointer-events: none;
  animation: sparkle-fly 700ms ease-out forwards;
  z-index: 10;
}
.sparkle-btn {
  position: relative;
  overflow: hidden;
}

/* ═══ Typography ═══ */
h1, h2, h3 { margin: 14px 0; letter-spacing: -0.025em; font-weight: 620; }
.card h2 { font-weight: 600; }
.card h3 { font-weight: 500; color: rgba(58,61,92,0.75); }

/* ═══ Grid ═══ */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ═══ Cards — glass capsules ═══ */
.card {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: radial-gradient(800px 200px at 20% 0%, rgba(255,255,255,0.40), transparent 55%);
  opacity: 0.8;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(122,60,255,0.18), rgba(255,123,229,0.12), rgba(94,224,198,0.10));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.45;
}

.card > * { position: relative; z-index: 1; }

/* ═══ Inputs ═══ */
input, textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.45);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin: 8px 0;
  outline: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 3px rgba(90,70,180,0.04), 0 6px 18px rgba(90,70,180,0.06);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  font-size: 14px;
}

textarea { min-height: 100px; }
input::placeholder, textarea::placeholder { color: rgba(58,61,92,0.35); }

input:focus, textarea:focus {
  border-color: rgba(76,111,255,0.45);
  box-shadow: var(--glow-strong);
  background: rgba(255,255,255,0.55);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bcast-text-entry {
  position: relative;
  margin-bottom: 8px;
}
.bcast-text-entry textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
}
.bcast-text-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  cursor: pointer;
}

.schedule-section {
  margin: 12px 0 6px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.schedule-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.schedule-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}
#scheduleFields {
  margin-top: 10px;
}
.schedule-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--stroke-2);
  border-radius: 12px;
  background: rgba(255,255,255,0.5);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: all 200ms ease;
}
.schedule-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(76,111,255,0.15);
  background: rgba(255,255,255,0.7);
}
.schedule-info {
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent-violet);
  font-weight: 500;
}

/* ═══ Buttons ═══ */
button {
  background: linear-gradient(135deg, rgba(255,255,255,0.45), rgba(255,255,255,0.22));
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 18px;
  padding: 11px 18px;
  cursor: pointer;
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 6px 22px rgba(90,70,180,0.10), 0 0 0 1px rgba(255,255,255,0.35);
  transition: all 220ms ease;
  font-weight: 520;
  font-size: 13px;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(90,70,180,0.16), 0 0 0 1px rgba(255,255,255,0.50);
  background: linear-gradient(135deg, rgba(255,255,255,0.55), rgba(255,255,255,0.35));
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.40);
  box-shadow: 0 4px 14px rgba(90,70,180,0.06);
}

.btn-small {
  padding: 8px 13px;
  border-radius: 14px;
  font-weight: 500;
  font-size: 12px;
}

.btn-chat-action {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}

.btn-chat-plus {
  font-size: 20px;
  line-height: 1;
  padding: 8px 0;
  min-width: 44px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  color: #fff;
  border-color: rgba(255,255,255,0.30);
  box-shadow: 0 8px 24px rgba(76,111,255,0.28);
}
.btn-chat-plus:hover {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-blue));
  box-shadow: 0 12px 32px rgba(76,111,255,0.35);
  color: #fff;
}

.btn-accent-blue {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  color: #fff;
  border: 1px solid rgba(255,255,255,0.30);
  box-shadow: 0 8px 24px rgba(76,111,255,0.22);
}
.btn-accent-blue:hover {
  box-shadow: 0 12px 32px rgba(76,111,255,0.32);
  color: #fff;
}

.btn-green {
  background: linear-gradient(135deg, #10b981, var(--accent-mint));
  color: #fff;
  border-color: rgba(255,255,255,0.30);
  box-shadow: 0 8px 24px rgba(16,185,129,0.22);
}
.btn-green:hover { color: #fff; box-shadow: 0 12px 32px rgba(16,185,129,0.30); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  border-color: rgba(255,255,255,0.30);
  box-shadow: 0 8px 24px rgba(239,68,68,0.18);
}
.btn-danger:hover { color: #fff; box-shadow: 0 12px 32px rgba(239,68,68,0.28); }

.btn-danger-outline {
  background: rgba(255,255,255,0.35);
  color: #c53030;
  border: 1px solid rgba(239,68,68,0.45);
  backdrop-filter: blur(12px);
}
.btn-danger-outline:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.6);
  color: #b91c1c;
}

.report-dropdown-wrap {
  position: relative;
}
.report-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 140px;
  padding: 6px;
  border-radius: 14px;
  background: var(--glass-2);
  border: 1px solid var(--stroke-2);
  box-shadow: var(--shadow-soft);
  z-index: 100;
}
.report-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.report-option:hover {
  background: rgba(255,255,255,0.4);
}

.chat-status-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chat-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.chat-status-tag.spam {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.chat-status-tag.blocked {
  background: rgba(107, 114, 128, 0.2);
  color: #4b5563;
  border: 1px solid rgba(107, 114, 128, 0.4);
}

.chat-list-tags { margin-left: 6px; }
.chat-list-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  margin-right: 4px;
}
.chat-list-tag.spam {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}
.chat-list-tag.blocked {
  background: rgba(107, 114, 128, 0.2);
  color: #4b5563;
}

/* Chat type badges — визуальное различие канал/группа/чат */
.chat-list-tag.type-channel,
.chat-status-tag.type-channel {
  background: rgba(139, 92, 246, 0.18);
  color: #6d28d9;
  border: 1px solid rgba(139, 92, 246, 0.35);
}
.chat-list-tag.type-group,
.chat-status-tag.type-group {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.chat-list-tag.type-chat,
.chat-status-tag.type-chat {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.chat-list-tag.type-bot,
.chat-status-tag.type-bot {
  background: rgba(99, 102, 241, 0.18);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.hint { font-size: 12px; color: var(--muted-2); line-height: 1.45; }
.error { margin-top: 8px; color: #c53030; }

/* ═══ Events ═══ */
.events {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
  padding: 10px;
  background: rgba(255,255,255,0.28);
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.events-collapsed { display: none; }

/* ═══ Account Cards ═══ */
.acc-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  margin-bottom: 8px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  transition: all 250ms cubic-bezier(0.22,0.68,0,1);
  position: relative;
  overflow: hidden;
}

.acc-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 70px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.30), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.acc-card:hover {
  border-color: var(--stroke-2);
  box-shadow: var(--glow-strong);
  transform: translateY(-2px);
}

.acc-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.acc-card-info { display: grid; gap: 8px; min-width: 0; }

.acc-card-title {
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.acc-card-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.acc-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 520;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.acc-chip-phone {
  background: rgba(16,185,129,0.10);
  border: 1px solid rgba(16,185,129,0.25);
  color: #047857;
}
.acc-chip-label {
  background: rgba(255,123,229,0.08);
  border: 1px solid rgba(255,123,229,0.22);
  color: #a855a0;
}
.acc-chip-id {
  background: rgba(76,111,255,0.08);
  border: 1px solid rgba(76,111,255,0.20);
  color: #3b5bdb;
}
.acc-chip-participation-on {
  background: rgba(16,185,129,0.10);
  border: 1px solid rgba(16,185,129,0.30);
  color: #047857;
}
.acc-chip-participation-off {
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.28);
  color: #991b1b;
}

.acc-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
  margin-right: 5px;
}
.acc-dot.ok {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16,185,129,0.50);
  animation: accDotPulse 2.5s ease-in-out infinite;
}
.acc-dot.bad {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,0.40);
}

@keyframes accDotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(16,185,129,0.50); }
  50%      { opacity: 0.5; box-shadow: 0 0 14px rgba(16,185,129,0.25); }
}

.acc-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.acc-profile-edit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
  z-index: 1;
}
.acc-profile-title {
  font-size: 11px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.acc-profile-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.acc-profile-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}
.acc-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.acc-profile-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}
.acc-profile-input,
.acc-profile-textarea {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
}
.acc-profile-textarea {
  resize: vertical;
  min-height: 44px;
}

.acc-card-wh {
  display: grid;
  gap: 6px;
  position: relative;
  z-index: 1;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.20);
}

.acc-wh-label {
  font-size: 11px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}

.acc-wh-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.acc-wh-row input {
  margin: 0;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 12px;
}

/* ═══ Badges ═══ */
.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.50);
  background: rgba(255,255,255,0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.badge.ok       { color: #047857; background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.28); }
.badge.bad      { color: #991b1b; background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.24); }
.badge.warn     { color: #7a4a00; background: rgba(255,205,86,0.12); border-color: rgba(255,205,86,0.28); }
.badge.schedule { color: #5b21b6; background: rgba(122,60,255,0.10); border-color: rgba(122,60,255,0.28); }

.bcast-card-schedule {
  margin: 4px 0 2px;
  font-size: 13px;
  color: var(--accent-violet);
}
.schedule-countdown {
  font-weight: 600;
  margin-left: 6px;
}

code {
  background: rgba(255,255,255,0.40);
  border: 1px solid rgba(255,255,255,0.55);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}

details summary { cursor: pointer; user-select: none; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 10px; }

.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.list { margin-top: 10px; display: grid; gap: 10px; }

/* ═══ Chat items ═══ */
.chat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}
.chat-item:hover { border-color: var(--stroke-2); box-shadow: var(--glow); }
.chat-meta { display: grid; gap: 4px; }
.chat-title { font-weight: 520; letter-spacing: -0.01em; }

/* ═══ Messages ═══ */
.messages {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  background: rgba(255,255,255,0.28);
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ═══ Shell layout ═══ */
.shell { display: grid; grid-template-columns: 360px 1fr 420px; gap: 18px; align-items: start; }

@media (min-width: 1400px) {
  .container { max-width: 1560px; }
  .shell { grid-template-columns: 420px 1fr 480px; }
}

.sidebar, .rightbar { display: grid; gap: 16px; }
.main { display: grid; gap: 16px; min-width: 0; }
.card-tight { padding: 16px; }
.messages-card { padding: 0; overflow: hidden; }

.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.chat-header-text { min-width: 0; flex: 1; }
.chat-header-avatar-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  line-height: 0;
}
.chat-header-avatar-btn:focus-visible {
  outline: 2px solid rgba(76, 111, 255, 0.5);
  outline-offset: 2px;
}
.chat-header-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.chat-head-title { font-weight: 620; letter-spacing: -0.02em; }
.chat-head-title.editable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(76,111,255,0.35);
}
.chat-head-title.editable:hover {
  color: #4c6fff;
  text-decoration-color: rgba(76,111,255,0.75);
}
.chat-header-actions { display: flex; gap: 8px; align-items: center; }

.chat-list {
  margin-top: 0;
  display: grid;
  gap: 0;
  grid-auto-rows: min-content;
  align-content: start;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 0;
}

.account-lock {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(76,111,255,0.06);
  border: 1px solid rgba(76,111,255,0.15);
}

/* ═══ Chat rows ═══ */
.chat-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 6px 8px;
  align-items: center;
  padding: 4px 7px;
  min-height: 38px;
  max-height: 38px;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(58,61,92,0.06);
  cursor: pointer;
  transition: background 150ms ease;
  overflow: hidden;
}
.chat-row:last-child { border-bottom: none; }
.chat-row:hover { background: rgba(76,111,255,0.04); }
.chat-row.active { background: rgba(76,111,255,0.08); }

.chat-left {
  display: grid;
  grid-template-rows: auto auto;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}
.chat-line1 {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.chat-name {
  font-weight: 560;
  font-size: 10px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
  color: var(--ink);
}
.chat-time { color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.chat-preview {
  display: block;
  min-width: 0;
  font-size: 11px;
  font-weight: 580;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  line-height: 1.1;
}

.chat-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  flex-shrink: 0;
}
.unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #4c6fff, #7c5cfc);
  box-shadow: 0 2px 8px rgba(76,111,255,0.35);
  line-height: 1;
  letter-spacing: -0.02em;
  animation: unread-pop 300ms ease-out;
}
@keyframes unread-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.chat-row.has-unread { background: rgba(76,111,255,0.06); }
.chat-row.has-unread .chat-name { color: var(--ink); font-weight: 650; }
.chat-row.has-unread .chat-preview { color: var(--ink); font-weight: 500; }

.chat-row-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}
.chat-row-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.chat-row-avatar-initials,
.chat-row-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(76, 111, 255, 0.12);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ═══ Bubbles ═══ */
.bubble-list { max-height: calc(100vh - 290px); overflow: auto; padding: 14px; display: grid; gap: 10px; }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }

.msg-date-divider {
  display: flex;
  justify-content: center;
  margin: 2px 0;
}
.msg-date-divider span {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 999px;
  padding: 3px 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.bubble {
  max-width: min(480px, 75%);
  padding: 10px 13px;
  border-radius: 18px;
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.50);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 6px 20px rgba(90,70,180,0.08);
}

.msg-row.mine .bubble {
  background: linear-gradient(135deg, rgba(76,111,255,0.15), rgba(122,60,255,0.10));
  border-color: rgba(76,111,255,0.22);
  box-shadow: 0 8px 26px rgba(76,111,255,0.12);
}

.bubble .meta { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.bubble .text { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }

.bubble .msg-attach-audio {
  margin-top: 8px;
  max-width: min(320px, 100%);
  position: relative;
  z-index: 8;
}
/* Скрытый плеер: нативные controls обрезались из-за height и плохо кликались в стеке пузырька */
.bubble .msg-attach-audio-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.bubble .msg-attach-audio-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bubble .msg-attach-audio-playbtn {
  flex: 0 0 auto;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid rgba(76, 111, 255, 0.35);
  background: linear-gradient(135deg, rgba(76, 111, 255, 0.2), rgba(122, 60, 255, 0.14));
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(76, 111, 255, 0.12);
}
.bubble .msg-attach-audio-playbtn:hover:not(:disabled) {
  border-color: rgba(76, 111, 255, 0.55);
  background: linear-gradient(135deg, rgba(76, 111, 255, 0.28), rgba(122, 60, 255, 0.2));
}
.bubble .msg-attach-audio-playbtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.bubble .msg-attach-audio-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bubble .msg-attach-audio-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.bubble .msg-attach-audio-placeholder {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(107, 110, 138, 0.12);
  border: 1px solid rgba(107, 110, 138, 0.2);
}

.msg-row.msg-row-has-actions { position: relative; }
.bubble.bubble-with-actions { position: relative; }
.bubble.bubble-with-actions .msg-actions {
  position: absolute;
  top: 6px;
  right: 8px;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  z-index: 6;
}
.msg-row.msg-row-has-actions:hover .bubble.bubble-with-actions .msg-actions,
.msg-row.msg-row-has-actions:focus-within .bubble.bubble-with-actions .msg-actions,
.bubble.bubble-with-actions:hover .msg-actions,
.msg-row.msg-row-show-actions .bubble.bubble-with-actions .msg-actions {
  display: flex;
}
.msg-btn {
  font-size: 13px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: var(--glass-2);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}
.msg-btn:hover {
  border-color: rgba(76, 111, 255, 0.35);
  background: rgba(255, 255, 255, 0.55);
}
.msg-actions .msg-btn-forward {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══ Luxurious composer + send button ═══ */
.composer { position: relative; }

.reply-preview-bar {
  margin: 0 0 8px 0;
  padding: 8px 10px 8px 12px;
  border-radius: 14px;
  background: rgba(107, 110, 138, 0.12);
  border: 1px solid rgba(107, 110, 138, 0.2);
}
.reply-preview-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.reply-preview-col {
  min-width: 0;
  flex: 1;
}
.reply-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.reply-preview-snippet {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-preview-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reply-preview-close:hover {
  background: rgba(255, 255, 255, 0.75);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  position: relative;
}
.composer textarea {
  flex: 1;
  min-height: 54px;
  max-height: 160px;
  resize: none;
  padding: 12px 16px;
  border-radius: 20px;
  border: 1px solid rgba(76,111,255,0.18);
  background: rgba(255,255,255,0.65);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 180ms, box-shadow 180ms;
}
.composer textarea:focus {
  outline: none;
  border-color: rgba(76,111,255,0.45);
  box-shadow: 0 0 0 3px rgba(76,111,255,0.12);
}

.send-btn-lux {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #7a3cff 0%, #4c6fff 50%, #5ee0c6 100%);
  box-shadow:
    0 8px 24px rgba(122,60,255,0.35),
    0 4px 12px rgba(76,111,255,0.25),
    inset 0 1px 0 rgba(255,255,255,0.4);
  color: #fff;
  font-size: 22px;
  transition: transform 180ms ease, box-shadow 220ms ease, filter 180ms ease;
  position: relative;
  overflow: visible;
}
.send-btn-lux:hover {
  transform: scale(1.06);
  box-shadow:
    0 12px 32px rgba(122,60,255,0.42),
    0 6px 16px rgba(76,111,255,0.3),
    inset 0 1px 0 rgba(255,255,255,0.5);
  filter: brightness(1.05);
}
.send-btn-lux:active {
  transform: scale(0.97);
}
.send-btn-lux:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.send-btn-icon {
  transform: rotate(-45deg);
  display: block;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Heart burst after send */
@keyframes heartBurst1 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5); } 50% { opacity: 1; transform: translate(-50%,-80px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%,-120px) scale(1.3); } }
@keyframes heartBurst2 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5) rotate(-25deg); } 50% { opacity: 1; transform: translate(calc(-50% - 45px),calc(-50% - 55px)) scale(1.1) rotate(-25deg); } 100% { opacity: 0; transform: translate(calc(-50% - 75px),calc(-50% - 90px)) scale(1.3) rotate(-25deg); } }
@keyframes heartBurst3 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5) rotate(25deg); } 50% { opacity: 1; transform: translate(calc(-50% + 45px),calc(-50% - 55px)) scale(1.1) rotate(25deg); } 100% { opacity: 0; transform: translate(calc(-50% + 75px),calc(-50% - 90px)) scale(1.3) rotate(25deg); } }
@keyframes heartBurst4 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5) rotate(-50deg); } 50% { opacity: 1; transform: translate(calc(-50% - 65px),calc(-50% - 25px)) scale(1.1) rotate(-50deg); } 100% { opacity: 0; transform: translate(calc(-50% - 100px),calc(-50% - 40px)) scale(1.3) rotate(-50deg); } }
@keyframes heartBurst5 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5) rotate(50deg); } 50% { opacity: 1; transform: translate(calc(-50% + 65px),calc(-50% - 25px)) scale(1.1) rotate(50deg); } 100% { opacity: 0; transform: translate(calc(-50% + 100px),calc(-50% - 40px)) scale(1.3) rotate(50deg); } }
@keyframes heartBurst6 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5) rotate(-10deg); } 50% { opacity: 1; transform: translate(calc(-50% - 25px),calc(-50% - 70px)) scale(1) rotate(-10deg); } 100% { opacity: 0; transform: translate(calc(-50% - 40px),calc(-50% - 110px)) scale(1.2) rotate(-10deg); } }
@keyframes heartBurst7 { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5) rotate(10deg); } 50% { opacity: 1; transform: translate(calc(-50% + 25px),calc(-50% - 70px)) scale(1) rotate(10deg); } 100% { opacity: 0; transform: translate(calc(-50% + 40px),calc(-50% - 110px)) scale(1.2) rotate(10deg); } }
.heart-burst {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 100000;
}
.heart-burst-fixed {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
}
.heart-burst span {
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: 20px;
  animation-duration: 1s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
  filter: drop-shadow(0 2px 4px rgba(255,105,180,0.4));
}
.heart-burst span:nth-child(1) { animation-name: heartBurst1; }
.heart-burst span:nth-child(2) { animation-name: heartBurst2; animation-delay: 0.05s; }
.heart-burst span:nth-child(3) { animation-name: heartBurst3; animation-delay: 0.1s; }
.heart-burst span:nth-child(4) { animation-name: heartBurst4; animation-delay: 0.15s; }
.heart-burst span:nth-child(5) { animation-name: heartBurst5; animation-delay: 0.2s; }
.heart-burst span:nth-child(6) { animation-name: heartBurst6; animation-delay: 0.08s; }
.heart-burst span:nth-child(7) { animation-name: heartBurst7; animation-delay: 0.12s; }

/* ═══ Account list (chat page) ═══ */
.accounts-list { display: grid; gap: 12px; margin-top: 10px; }

.account-item {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow-soft);
}

.account-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.account-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.account-name { font-weight: 650; font-size: 15px; }
.account-phone { font-size: 13px; color: var(--muted); }
.status-connected { color: #047857; font-size: 13px; }
.status-disconnected { color: #c53030; font-size: 13px; }
.account-btns { display: flex; gap: 8px; align-items: center; }

.account-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.18);
}
.account-option-label { font-size: 13px; color: var(--muted); }
.account-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.account-toggle input { width: auto; margin: 0; }

.account-restriction-row {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.18);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  line-height: 1.4;
}
.restr-label { font-weight: 600; color: #dc2626; }
.restr-sep { color: rgba(100,50,50,0.3); }
.restr-date { color: #991b1b; font-weight: 500; }
.restr-remain {
  font-weight: 700;
  color: #dc2626;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239,68,68,0.10);
  white-space: nowrap;
}

.add-account-box {
  padding: 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.30);
}

/* ═══ Chat modal ═══ */
.chat-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(30,27,75,0.30);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.chat-modal-inner {
  position: relative;
  width: 96%; max-width: 1020px; height: 85vh;
  display: grid; grid-template-columns: 300px 1fr;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,0.60);
  box-shadow: 0 24px 80px rgba(90,70,180,0.22);
}

/* Просмотр вложенной картинки поверх окна чата (без новой вкладки) */
.chat-image-preview-layer--viewport {
  position: fixed;
  inset: 0;
  z-index: 5000;
  border-radius: 0;
}
.chat-image-preview-layer {
  position: absolute;
  inset: 0;
  z-index: 400;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 16px;
  box-sizing: border-box;
  background: rgba(12, 10, 28, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.chat-image-preview-layer.is-open {
  display: flex;
}
.chat-image-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chat-image-preview-close:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
}
.chat-image-preview-frame {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-image-preview-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  cursor: default;
  user-select: none;
}

.chat-sidebar-panel {
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(58,61,92,0.06);
  overflow: hidden;
  background: rgba(255,255,255,0.10);
}
.chat-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 10px 0; gap: 8px;
  font-weight: 620; font-size: 14px;
}
.chat-sidebar-panel .chat-list { flex: 1; margin-top: 0; max-height: none; overflow-y: auto; padding: 0; gap: 0; }

.chat-main-panel { display: flex; flex-direction: column; overflow: hidden; }
.chat-main-panel .chat-header { padding: 14px 18px; border-bottom: 1px solid rgba(58,61,92,0.06); }
.chat-main-panel .bubble-list { flex: 1; max-height: none; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 18px; }
.chat-main-panel .composer { padding: 12px 18px; border-top: 1px solid rgba(58,61,92,0.06); position: relative; }
.chat-main-panel .composer textarea { min-height: 54px; }
.chat-main-panel .composer-row { gap: 12px; }

/* ═══ Phone modal ═══ */
.phone-modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(30,27,75,0.35);
  display: flex; align-items: center; justify-content: center;
}
.phone-modal-inner {
  width: 92%; max-width: 420px; padding: 24px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: 0 20px 60px rgba(90,70,180,0.22);
}
.phone-modal-inner input, .phone-modal-inner textarea { width: 100%; box-sizing: border-box; }
.forward-modal-inner { max-width: 440px; max-height: 85vh; display: flex; flex-direction: column; }
.forward-modal-list {
  max-height: min(52vh, 380px);
  overflow-y: auto;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.forward-item {
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 8px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(107, 110, 138, 0.2);
  background: rgba(255, 255, 255, 0.55);
  font: inherit;
  color: var(--ink);
}
.forward-item:hover {
  background: #f0ecfa;
  border-color: rgba(76, 111, 255, 0.28);
}
.forward-name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
  line-height: 1.25;
}
.forward-phone {
  font-size: 12px;
  color: #9b97b8;
  margin-top: 2px;
  line-height: 1.2;
}
.forward-phone-empty {
  color: #888;
  opacity: 0.45;
}
.form-label { font-size: 13px; font-weight: 500; color: var(--muted); display: block; margin-bottom: 2px; }

/* ═══ Broadcast History ═══ */
.bcast-history-card {
  display: grid; gap: 10px; padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
  transition: all 200ms ease;
  margin-bottom: 4px;
}
.bcast-history-card:hover { box-shadow: var(--glow); }

.bcast-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bcast-card-date { font-weight: 620; font-size: 14px; }
.bcast-card-recipients { line-height: 1.4; }
.bcast-card-counts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.bcast-count-ok { color: #047857; }
.bcast-count-err { color: #991b1b; }
.bcast-card-msg { padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.28); border: 1px solid rgba(255,255,255,0.40); font-size: 13px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.bcast-card-actions { display: flex; gap: 8px; align-items: center; }

/* Lux live progress bar */
.lux-progress-wrap {
  margin-top: 4px;
  display: grid;
  gap: 6px;
}
.lux-progress-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(255,255,255,0.62);
  box-shadow: inset 0 1px 2px rgba(90,70,180,0.10), 0 4px 14px rgba(90,70,180,0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lux-progress-fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  transition: width 300ms ease, filter 220ms ease, opacity 220ms ease;
  min-width: 0;
}
.lux-progress-fill.active {
  background:
    linear-gradient(90deg, rgba(164,139,255,0.96), rgba(124,92,252,0.98), rgba(186,164,255,0.95));
  box-shadow:
    0 0 18px rgba(124,92,252,0.30),
    inset 0 1px 0 rgba(255,255,255,0.55);
}
.lux-progress-fill.active::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 54px;
  right: -54px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.75), rgba(255,255,255,0));
  animation: luxProgressSweep 1.6s linear infinite;
}
.lux-progress-fill.ok {
  background:
    linear-gradient(90deg, rgba(155,137,255,0.92), rgba(120,102,240,0.95), rgba(176,201,255,0.90));
  box-shadow:
    0 0 16px rgba(120,102,240,0.26),
    inset 0 1px 0 rgba(255,255,255,0.50);
}
.lux-progress-fill.bad {
  background:
    linear-gradient(90deg, rgba(169,141,255,0.88), rgba(123,88,230,0.93), rgba(150,115,240,0.88));
  box-shadow:
    0 0 14px rgba(123,88,230,0.24),
    inset 0 1px 0 rgba(255,255,255,0.45);
}
.lux-progress-label {
  font-size: 12px;
  color: var(--muted);
}
.lux-progress-label b {
  color: var(--ink);
}
@keyframes luxProgressSweep {
  0% { transform: translateX(0); opacity: 0; }
  20% { opacity: 0.95; }
  100% { transform: translateX(260px); opacity: 0; }
}

/* ═══ Broadcast Stats Modal ═══ */
.bcast-modal {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(30,27,75,0.35);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: bcastFadeIn 180ms ease;
}
@keyframes bcastFadeIn { from { opacity: 0; } to { opacity: 1; } }

.bcast-modal-inner {
  width: 96%; max-width: 960px; max-height: 90vh;
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,0.70);
  box-shadow: 0 24px 80px rgba(90,70,180,0.25);
  overflow: hidden;
  animation: bcastSlideUp 220ms cubic-bezier(0.22,0.68,0,1);
}
@keyframes bcastSlideUp { from { transform: translateY(30px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }

.bcast-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid rgba(58,61,92,0.06); flex-shrink: 0; }
.bcast-modal-header h2 { font-size: 18px; font-weight: 640; }
.bcast-modal-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }

.bcast-stats-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bcast-stats-date { font-weight: 620; font-size: 15px; }
.bcast-stats-counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }

.bcast-counter {
  text-align: center; padding: 12px 8px;
  border-radius: 16px;
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.50);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.bcast-counter.ok { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.20); }
.bcast-counter.bad { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.18); }
.bcast-counter-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.bcast-counter.ok .bcast-counter-value { color: #047857; }
.bcast-counter.bad .bcast-counter-value { color: #991b1b; }
.bcast-counter-label { font-size: 11px; font-weight: 520; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 2px; }

.bcast-msg-text { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.30); border: 1px solid rgba(255,255,255,0.45); font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow-y: auto; }

.bcast-table-wrap { width: 100%; overflow-x: auto; }
.bcast-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.bcast-table th, .bcast-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid rgba(76,111,255,0.06); vertical-align: top; }
.bcast-table th { font-weight: 620; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); position: sticky; top: 0; background: rgba(255,255,255,0.80); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bcast-table tbody tr:hover { background: rgba(76,111,255,0.03); }
.bcast-link-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bcast-link-btn:hover {
  color: var(--accent-violet);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.bcast-status-pill { display: inline-flex; align-items: center; gap: 3px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 560; }
.bcast-status-pill.ok   { color: #047857; background: rgba(16,185,129,0.10); border: 1px solid rgba(16,185,129,0.25); }
.bcast-status-pill.bad  { color: #991b1b; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.20); }
.bcast-status-pill.warn { color: #7a4a00; background: rgba(255,205,86,0.12); border: 1px solid rgba(255,205,86,0.30); }

/* ═══ Warmup ═══ */
.warmup-settings {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(76,111,255,0.12);
  background: rgba(76,111,255,0.03);
}
.warmup-settings legend {
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  padding: 0 6px;
}
.warmup-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.warmup-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.warmup-field input[type="number"] {
  width: 120px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(76,111,255,0.15);
  background: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
}

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .chat-list { max-height: none; }
  .bubble-list { max-height: 60vh; }
  .topbar-top { flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px 12px; }
  .topbar-nav { gap: 5px; }
  .nav-tab { padding: 9px 14px; font-size: 12px; }
  .topbar-action-text { display: none; }
  .chat-modal-inner { grid-template-columns: 1fr; height: 90vh; }
  .chat-sidebar-panel { max-height: 40vh; }
  .bcast-modal-inner { width: 100%; max-width: none; max-height: 95vh; }
  .bcast-stats-counters { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ Переавторизация (reauth) ═══ */
.reauth-dropzone {
  border: 2px dashed rgba(76,111,255,0.35);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: rgba(255,255,255,0.4);
  transition: background 0.2s, border-color 0.2s;
}
.reauth-dropzone:hover,
.reauth-dropzone.dragover {
  background: rgba(255,255,255,0.6);
  border-color: rgba(76,111,255,0.55);
}
.reauth-dropzone-text {
  color: var(--muted);
  font-size: 14px;
}
.reauth-preview { margin-top: 10px; }
.reauth-status { font-size: 14px; }
.reauth-status .status-label { font-weight: 500; margin-right: 6px; }
.reauth-result-pre,
.reauth-logs-pre {
  background: rgba(0,0,0,0.06);
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}
.form-select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(76,111,255,0.2);
  background: rgba(255,255,255,0.7);
  font-size: 14px;
  min-width: 220px;
}
