/* Карточка пользователя и экран входа HolyCode (account.js) — одни стили для
   чата, HolyBuild, панели HolyAgent и панели «Персонал». Цвета — переменные
   --hca-* с токенами меню чата (макет «Навигация» 27.09.2026); тёмная тема по
   умолчанию, data-theme="light" даёт светлую. Байт в байт во всех копиях. */

.hca,
.hca-signin-page {
  --hca-bg: #141226;
  --hca-border: #3d3566;
  --hca-divider: #2a2450;
  --hca-text: #ece7ff;
  --hca-muted: #9f96cf;
  --hca-icon: #b69cff;
  --hca-hover: rgba(139, 92, 246, 0.14);
  --hca-seg-border: #2e2748;
  --hca-seg-hover: rgba(255, 255, 255, 0.05);
  --hca-seg-on-bg: rgba(139, 92, 246, 0.24);
  --hca-seg-on-fg: #e2d8ff;
  --hca-danger: #fca5a5;
  --hca-warn-fg: #fbbf24;
  --hca-warn-bg: rgba(251, 191, 36, 0.08);
  --hca-warn-border: rgba(251, 191, 36, 0.35);
  --hca-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --hca-ring: rgba(141, 105, 255, 0.6);
  --hca-page: #0e0d1b;
  --hca-avatar: linear-gradient(135deg, #3b82f6, #6366f1);
  --hca-avatar-ring: #8b5cf6;
  --hca-plaque-bg: rgba(139, 92, 246, 0.08);
  --hca-plaque-border: rgba(139, 92, 246, 0.28);
  --hca-plaque-hover: rgba(139, 92, 246, 0.16);
  --hca-card-bg: rgba(17, 16, 28, 0.95);
  --hca-card-border: #2e2748;
  --hca-card-shadow: 0 32px 90px -36px rgba(124, 58, 237, 0.45);
  --hca-page-bg: #07070d;
  --hca-page-glow: radial-gradient(circle at top, rgba(124, 58, 237, 0.26), transparent 38%), radial-gradient(circle at bottom right, rgba(6, 182, 212, 0.12), transparent 34%);
  --hca-logo-bg: rgba(0, 0, 0, 0.25);
  --hca-logo-border: rgba(167, 139, 250, 0.3);
  --hca-error-fg: #fecaca;
  --hca-error-bg: rgba(239, 68, 68, 0.1);
  --hca-error-border: rgba(239, 68, 68, 0.3);
  --hca-chip-fg: #c4b5fd;
  --hca-chip-bg: rgba(139, 92, 246, 0.1);
  --hca-chip-border: rgba(139, 92, 246, 0.3);
  --hca-input-bg: #0f0e1d;
  --hca-input-border: #3a345d;
}

.hca[data-theme="light"],
.hca-signin-page[data-theme="light"] {
  --hca-bg: #ffffff;
  --hca-border: #e5e7eb;
  --hca-divider: #f3f4f6;
  --hca-text: #111827;
  --hca-muted: #6b7280;
  --hca-icon: #7c3aed;
  --hca-hover: #f3f4f6;
  --hca-seg-border: #e5e7eb;
  --hca-seg-hover: #f9fafb;
  --hca-seg-on-bg: #ede9fe;
  --hca-seg-on-fg: #5b21b6;
  --hca-danger: #dc2626;
  --hca-warn-fg: #b45309;
  --hca-warn-bg: #fffbeb;
  --hca-warn-border: #fde68a;
  --hca-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
  --hca-ring: rgba(167, 139, 250, 0.5);
  --hca-page: #ffffff;
  --hca-plaque-bg: #f5f3ff;
  --hca-plaque-border: #ddd6fe;
  --hca-plaque-hover: #ede9fe;
  --hca-card-bg: #ffffff;
  --hca-card-border: #e5e7eb;
  --hca-card-shadow: 0 32px 90px -40px rgba(124, 58, 237, 0.18);
  --hca-page-bg: #f3f4f6;
  --hca-page-glow: radial-gradient(circle at top, rgba(124, 58, 237, 0.16), transparent 36%), radial-gradient(circle at bottom right, rgba(6, 182, 212, 0.1), transparent 32%);
  --hca-logo-bg: #ffffff;
  --hca-logo-border: #ddd6fe;
  --hca-error-fg: #991b1b;
  --hca-error-bg: #fef2f2;
  --hca-error-border: #fecaca;
  --hca-chip-fg: #6d28d9;
  --hca-chip-bg: #f5f3ff;
  --hca-chip-border: #ddd6fe;
  --hca-input-bg: #ffffff;
  --hca-input-border: #d1d5db;
}

.hca {
  position: relative;
  display: inline-block;
  flex: none;
  min-width: 0;
  color: var(--hca-text);
  font-family: inherit;
  text-align: left;
}

.hca *,
.hca *::before,
.hca *::after,
.hca-signin-page *,
.hca-signin-page *::before,
.hca-signin-page *::after { box-sizing: border-box; }

/* ── аватар ─────────────────────────────────────────────────────────────── */

.hca-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--hca-avatar);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.hca-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.hca-trigger:hover { transform: scale(1.04); }
.hca-trigger:focus { outline: none; }
.hca-trigger:focus-visible { box-shadow: 0 0 0 2px var(--hca-ring); }
.hca-trigger .hca-avatar { box-shadow: 0 0 0 2px var(--hca-avatar-ring); }
.hca--compact .hca-trigger { width: 32px; height: 32px; }
.hca--compact .hca-trigger .hca-avatar { width: 30px; height: 30px; font-size: 12px; }

.hca-attn {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--hca-page);
  border-radius: 999px;
  background: #fbbf24;
}

/* ── плашка в боковой панели (HolyAgent): аватар, имя, @логин ─────────────── */

.hca--plaque { display: block; width: 100%; }
.hca-plaque {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--hca-plaque-border);
  border-radius: 12px;
  background: var(--hca-plaque-bg);
  color: var(--hca-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.hca-plaque:hover { background: var(--hca-plaque-hover); }
.hca-plaque:focus { outline: none; }
.hca-plaque:focus-visible { box-shadow: 0 0 0 2px var(--hca-ring); }
.hca-plaque .hca-avatar { position: relative; width: 28px; height: 28px; font-size: 11px; }
.hca-plaque .hca-attn { top: -2px; right: -2px; }
.hca-plaque-text { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.25; }
.hca-plaque-name { overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.hca-plaque-sub { overflow: hidden; color: var(--hca-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.hca-plaque-caret { display: inline-flex; flex: none; color: var(--hca-muted); transform: rotate(180deg); }
.hca--collapsed .hca-plaque { justify-content: center; padding: 5px 0; border-color: transparent; background: transparent; }
.hca--collapsed .hca-plaque-text,
.hca--collapsed .hca-plaque-caret { display: none; }

/* ── меню ────────────────────────────────────────────────────────────────── */

.hca-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10050;
  width: 312px;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid var(--hca-border);
  border-radius: 14px;
  background: var(--hca-bg);
  box-shadow: var(--hca-shadow);
  color: var(--hca-text);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
}
.hca--start .hca-pop { right: auto; left: 0; }
.hca--up .hca-pop { top: auto; right: auto; bottom: calc(100% + 8px); left: 0; }

/* На телефоне меню из шапки — во всю ширину с отступом 12 px, под шапкой. */
@media (max-width: 639.98px) {
  .hca:not(.hca--up) .hca-pop { position: fixed; top: 58px; right: 12px; left: 12px; width: auto; max-width: none; }
  .hca--up .hca-pop { width: min(312px, calc(100vw - 1.5rem)); }
}

.hca-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 6px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--hca-divider);
}
.hca-head .hca-avatar { width: 36px; height: 36px; font-size: 14px; }
.hca-head-text { min-width: 0; }
.hca-head-name { display: block; overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.hca-head-sub { display: block; overflow: hidden; color: var(--hca-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.hca-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.hca-item:hover,
.hca-item:focus-visible { outline: none; background: var(--hca-hover); color: inherit; text-decoration: none; }
.hca-item--static { cursor: default; }
.hca-item--static:hover { background: transparent; }
.hca-item--danger,
.hca-item--danger:hover,
.hca-item--danger .hca-ic { color: var(--hca-danger); }

.hca-ic { display: flex; flex: none; align-items: center; justify-content: center; width: 20px; height: 20px; color: var(--hca-icon); }
.hca-lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hca-right { flex: none; margin-left: auto; padding-left: 8px; color: var(--hca-muted); font-size: 11.5px; white-space: nowrap; }
.hca-pill {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--hca-warn-border);
  border-radius: 999px;
  background: var(--hca-warn-bg);
  color: var(--hca-warn-fg);
  font-size: 11px;
  white-space: nowrap;
}

.hca-seg { display: inline-flex; flex: none; margin-left: auto; overflow: hidden; border: 1px solid var(--hca-seg-border); border-radius: 8px; }
.hca-seg-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 24px;
  margin: 0;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: var(--hca-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.hca-seg-item:hover { background: var(--hca-seg-hover); color: var(--hca-text); }
.hca-seg-item:focus { outline: none; }
.hca-seg-item:focus-visible { box-shadow: inset 0 0 0 2px var(--hca-ring); }
.hca-seg-item[aria-checked="true"] { background: var(--hca-seg-on-bg); color: var(--hca-seg-on-fg); }

.hca-hr { height: 0; margin: 6px 0; border: 0; border-top: 1px solid var(--hca-divider); }

/* «Другие сервисы» в меню — только на телефоне, где нет кнопки-сетки. */
.hca-phone-only { display: block; }
@media (min-width: 768px) {
  .hca-phone-only { display: none; }
}

/* ── экран входа ─────────────────────────────────────────────────────────── */

.hca-signin-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 16px;
  background-color: var(--hca-page-bg);
  background-image: var(--hca-page-glow);
  color: var(--hca-text);
  font-family: inherit;
}
.hca-signin {
  width: 100%;
  max-width: 448px;
  padding: 26px;
  border: 1px solid var(--hca-card-border);
  border-radius: 28px;
  background: var(--hca-card-bg);
  box-shadow: var(--hca-card-shadow);
  backdrop-filter: blur(8px);
  text-align: left;
}
@media (max-width: 479.98px) {
  .hca-signin { padding: 22px 18px; border-radius: 24px; }
}
.hca-signin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hca-signin-brand { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }
.hca-signin-brand img { width: 40px; height: 40px; flex: none; padding: 6px; border: 1px solid var(--hca-logo-border); border-radius: 12px; background: var(--hca-logo-bg); }
.hca-signin-langs { display: inline-flex; flex: none; gap: 4px; }
.hca-signin-lang {
  min-width: 40px;
  padding: 6px 10px;
  border: 1px solid var(--hca-input-border);
  border-radius: 10px;
  background: transparent;
  color: var(--hca-text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.hca-signin-lang:hover { background: var(--hca-seg-hover); }
.hca-signin-lang[aria-pressed="true"] { border-color: transparent; background: #8b5cf6; color: #fff; box-shadow: 0 10px 24px rgba(139, 92, 246, 0.28); }
.hca-signin-body { display: grid; gap: 16px; margin-top: 24px; }
.hca-signin-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; }
.hca-signin-sub { margin: 4px 0 0; color: var(--hca-muted); font-size: 14px; line-height: 1.6; }
.hca-signin-chip {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--hca-chip-border);
  border-radius: 999px;
  background: var(--hca-chip-bg);
  color: var(--hca-chip-fg);
  font-size: 12px;
}
.hca-signin-busy { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 32px; padding: 24px 0; color: var(--hca-muted); font-size: 14px; }
.hca-spinner {
  width: 20px;
  height: 20px;
  flex: none;
  border: 2px solid rgba(182, 156, 255, 0.25);
  border-top-color: var(--hca-icon);
  border-radius: 999px;
  animation: hca-spin 0.9s linear infinite;
}
@keyframes hca-spin { to { transform: rotate(360deg); } }
.hca-signin-error {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--hca-error-border);
  border-radius: 16px;
  background: var(--hca-error-bg);
  color: var(--hca-error-fg);
  font-size: 14px;
  line-height: 1.6;
}
.hca-signin-error svg { flex: none; margin-top: 4px; }
.hca-signin-error a { display: block; margin-top: 4px; color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.hca-signin-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #7c3aed, #8b5cf6);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.38);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.hca-signin-button:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.hca-signin-button:focus { outline: none; }
.hca-signin-button:focus-visible { box-shadow: 0 0 0 3px var(--hca-ring); }
.hca-signin-button:disabled { cursor: not-allowed; opacity: 0.6; }
.hca-signin-code { color: var(--hca-muted); font-size: 12px; text-align: center; }
.hca-signin-alt { padding-top: 12px; border-top: 1px solid var(--hca-divider); color: var(--hca-muted); font-size: 13px; }
.hca-signin-alt > summary { cursor: pointer; }
.hca-signin-alt > summary:hover { color: var(--hca-text); }
