.profile-card__avatar {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: var(--accent-foreground);
  font-size: 1.8rem;
  font-weight: 800;
}

.profile-details {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0 0;
}

.profile-details div {
  padding: 1rem;
  border-radius: 18px;
  background: var(--bg-soft);
}

.profile-details dt {
  margin-bottom: 0.35rem;
  color: var(--text-faint);
  font-size: 0.92rem;
}

.profile-details dd {
  margin: 0;
  font-weight: 600;
}

.quick-actions {
  display: grid;
  gap: 0.9rem;
}

.quick-action {
  display: block;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action span {
  margin-top: 0.35rem;
  color: var(--text-faint);
  font-size: 0.95rem;
}

.quick-action:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.quick-action:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.55);
  outline-offset: 3px;
}

.devices-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.device-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.device-card__header,
.detail-card__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.device-card__title {
  font-size: 1.2rem;
  font-weight: 700;
}

.device-card__meta,
.device-card__summary,
.back-link {
  color: var(--text-support);
}

.device-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.device-stats span {
  display: block;
  color: var(--text-minor);
  font-size: 0.9rem;
}

.device-stats strong {
  display: block;
  margin-top: 0.25rem;
}

.usage-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.usage-track__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.tag-chip--hero {
  background: var(--control-bg);
  border: 1px solid var(--border-subtle);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.device-card__footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-top: auto;
  color: var(--text-minor);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pill--online {
  color: var(--accent-foreground);
  background: rgba(196, 181, 253, 0.95);
}

.status-pill--syncing {
  color: #3a2400;
  background: rgba(251, 191, 36, 0.92);
}

.status-pill--maintenance {
  color: #3f0d18;
  background: rgba(251, 113, 133, 0.9);
}

.detail-card {
  display: grid;
  gap: 1.25rem;
}

.secret-key-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  border-radius: 18px;
  background: var(--bg-soft);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Крестик закрытия панели токена/секрета (ведёт на чистый /devices). */
.secret-panel {
  position: relative;
}

/* Форма-обёртка крестика не занимает места — кнопка позиционируется абсолютно. */
.secret-close-form {
  display: contents;
}

.secret-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-well);
  color: var(--text-support);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.secret-close svg {
  width: 16px;
  height: 16px;
}

.secret-close:hover,
.secret-close:focus-visible {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.08);
}

/* Место под крестик, чтобы он не наезжал на заголовок. */
.secret-panel .section-heading {
  padding-right: 2.6rem;
}

.secret-key-box code {
  flex: 1 1 280px;
  min-width: 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--code-inset);
  color: var(--accent);
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.not-found-card {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 2.5rem;
}

.hero-panel__cta {
  display: block;
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.14), rgba(167, 139, 250, 0.06));
  border: 1px solid rgba(167, 139, 250, 0.2);
  color: #fff;
  font-weight: 600;
  text-align: center;
}

.hero-panel__cta:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(167, 139, 250, 0.08));
}

.hero-panel__cta:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: 3px;
}

.section-block--muted {
  background: linear-gradient(180deg, var(--section-muted-fade), rgba(255, 255, 255, 0));
}

.not-found-code {
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 1;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 1rem;
}

.site-footer {
  padding: 1rem 0 3rem;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.site-footer__title {
  font-size: 1rem;
  margin: 0 0 0.8rem;
}

.site-footer__copy,
.site-footer__links a {
  color: var(--text-soft);
}

.site-footer__links {
  display: grid;
  gap: 0.5rem;
}

/* На фоновой картинке подвал должен читаться — делаем его плотной панелью
   и повышаем контраст текста (светлая тема). */
html[data-theme="light"] .site-footer__grid {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.22);
}

html[data-theme="light"] .site-footer__copy,
html[data-theme="light"] .site-footer__links a {
  color: rgba(10, 10, 14, 0.76);
}

html[data-theme="light"] .site-footer__links a:hover {
  color: var(--accent);
}

@media (max-width: 991.98px) {
  :root {
    --glass-blur: 8px;
  }

  .hero-grid,
  .auth-grid,
  .dashboard-shell,
  .device-layout,
  .feature-grid,
  .pricing-grid,
  .site-footer__grid,
  .hero-metrics,
  .detail-metrics {
    grid-template-columns: 1fr;
  }

  /* Auth-страницы (вход, сброс/восстановление пароля, 2FA): на узких экранах
     прячем маркетинговую колонку, оставляем только форму. */
  .auth-copy {
    display: none;
  }

  .hero-section,
  .auth-section,
  .dashboard-section,
  .not-found-section {
    padding-top: 2rem;
  }

  .site-header__inner {
    min-height: 72px;
  }

  .cta-banner,
  .device-card__footer,
  .detail-card__header,
  .status-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 575.98px) {
  .app-toast-stack {
    top: 84px;
    right: 16px;
    left: 16px;
    width: auto;
    transform: none;
  }

  .glass-panel,
  .feature-card,
  .cta-banner,
  .not-found-card {
    padding: 1.2rem;
    border-radius: 22px;
  }

  .display-title {
    font-size: 2.35rem;
  }

  .auth-form-grid,
  .social-auth-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid--landing {
    min-height: auto;
  }

  .device-stats {
    grid-template-columns: 1fr;
  }
}

.devices-grid--metrics {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.devices-grid--dense {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* Профиль: две колонки одинаковой ширины и высоты. Левый блок при этом
   распределяет содержимое (__grow прижимает «Безопасность» к низу), правый
   держим компактным, чтобы общая высота не раздувалась. */
.dashboard-shell--profile {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

/* Оба блока — колонка-флекс; растягивающийся элемент (__grow) забирает
   свободное место, прижимая нижнюю секцию к низу, — блоки выходят равными
   по высоте с ровным распределением содержимого. */
.profile-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Имя в шапке профиля — крупное, но не гигантское (карточный контекст). */
.profile-panel .profile-title h1 {
  font-size: 1.9rem;
  line-height: 1.15;
  margin: 0;
}

/* Плотнее строки данных. */
.profile-panel .info-list {
  gap: 0.7rem;
}

/* Правый блок несёт класс .sub-card (он задаёт display:grid и грузится позже),
   поэтому здесь возвращаем флекс-колонку с большей специфичностью, чтобы
   работал __grow (равномерное распределение по высоте). */
.profile-panel--side.sub-card {
  display: flex;
  flex-direction: column;
}

.profile-panel__grow {
  flex: 1 1 auto;
}

/* Правая колонка — стопка из двух блоков (подписка + быстрые действия). */
.profile-side-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.profile-actions-panel .section-label {
  margin-bottom: 0.9rem;
}

/* Внутри панели-флекса отступы задаёт gap — у разделителя свой margin убираем. */
.profile-panel .divider {
  margin: 0;
}

/* Список инфо-строк (Имя/Фамилия/Email/Телефон). */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* Заголовок секции внутри панели (иконка + название). */
.panel-section__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-section__header h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* Текст-ссылка (напр. «Настроить») — не кнопка, слово с подчёркиванием. */
.info-link {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.info-link:hover,
.info-link:focus-visible {
  border-bottom-color: currentColor;
}

.info-row--security .info-value {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

/* Мета-информация внизу страницы безопасности (даты) — компактная колонка. */
.security-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 460px;
}

/* Быстрые действия — горизонтальная компактная плитка: иконка | текст | стрелка. */
.quick-actions--modern {
  gap: 0.7rem;
}

.quick-actions--modern .quick-action {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
}

.quick-actions--modern .quick-action__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: 0;
  flex: 0 0 auto;
  border-radius: 11px;
  background: rgba(45, 212, 191, 0.14);
  border: 1px solid rgba(45, 212, 191, 0.24);
  color: var(--accent);
}

.quick-action__content {
  flex: 1 1 auto;
  min-width: 0;
}

.quick-actions--modern .quick-action__content strong {
  display: block;
  font-size: 0.98rem;
}

.quick-actions--modern .quick-action__content span {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-faint);
  font-size: 0.85rem;
}

.quick-actions--modern .quick-action__arrow {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  margin-top: 0;
  color: var(--text-minor);
  transition: transform 0.15s ease, color 0.15s ease;
}

.quick-action:hover .quick-action__arrow {
  transform: translateX(3px);
  color: var(--accent);
}

html[data-theme="light"] .quick-action__icon {
  background: rgba(15, 118, 110, 0.10);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--accent);
}

/* На планшете/телефоне блоки профиля в один столбец. */
@media (max-width: 991.98px) {
  .dashboard-shell--profile {
    grid-template-columns: 1fr;
  }
}

.status-bar {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
}

.status-bar--success {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.35), rgba(16, 185, 129, 0.85));
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-panel__pulse {
    animation: none;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.35);
  }

  .app-toast {
    transition: none;
  }

  .site-nav__link,
  .menu-toggle span {
    transition: none;
  }

  .cloud-card__step,
  .cloud-card__benefit,
  .cloud-card__btn {
    transition: none;
  }
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.55);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(167, 139, 250, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
  }
}

/* Фикс для иконок в профиле */

/* Иконка в аватаре */
.profile-avatar svg {
  width: 48px;
  height: 48px;
}

/* Иконка статуса (зелёная точка) */
.profile-status-badge svg {
  width: 16px;
  height: 16px;
}

/* Иконки в заголовках карточек */
.info-card__icon svg {
  width: 20px;
  height: 20px;
}

/* Иконка редактирования в кнопке */
.profile-edit-btn svg {
  width: 18px;
  height: 18px;
}

/* Иконки в быстрых действиях */
.quick-action__icon svg {
  width: 22px;
  height: 22px;
}

.quick-action__arrow svg {
  width: 18px;
  height: 18px;
}

/* Иконки в заголовках секций */
.section-heading h2 svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 6px;
}

/* Иконки в статусах */
.status-item__label svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 6px;
}

.status-item__info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.status-item__label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.status-item__value {
  margin-left: auto;
  text-align: right;
  flex: 0 0 auto;
}

/* Иконка в подвале статусов */
.status-note svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 6px;
}

/* Убираем возможные гигантские размеры у всех SVG внутри profile-компонентов */
.profile-glass-panel svg,
.profile-grid svg,
.info-card svg,
.quick-actions--modern svg,
.status-panel svg {
  max-width: 100%;
  height: auto;
}

/* ===== Profile page layout polish ===== */

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
  margin-top: 1.1rem;
}

.profile-avatar {
  position: relative;
}

.profile-edit-fab {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface-well);
  border: 1px solid var(--border);
  color: var(--text-on-glass);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  text-decoration: none;
}

.profile-edit-fab svg {
  width: 18px;
  height: 18px;
  display: block;
}

.profile-edit-fab__tooltip {
  position: absolute;
  top: -10px;
  right: 42px;
  transform: translateY(-50%);
  padding: 0.45rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.profile-edit-fab:hover .profile-edit-fab__tooltip,
.profile-edit-fab:focus-visible .profile-edit-fab__tooltip {
  opacity: 1;
  visibility: visible;
}

.info-card--full {
  grid-column: 1 / -1;
}

.info-card {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 20, 26, 0.5);
  border-radius: 22px;
  padding: 1.1rem 1.1rem 1rem;
  box-shadow: 0 20px 44px -28px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

html[data-theme="light"] .info-card {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.4);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 18px 40px -28px rgba(0, 0, 0, 0.22);
}

/* Card-level action (e.g. "Настроить безопасность") pinned to the bottom so
   cards in the same row stay visually aligned regardless of row count. */
.info-card__action {
  align-self: flex-start;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--accent);
  background: var(--surface-well);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  text-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.info-card__action svg {
  width: 16px;
  height: 16px;
}

.info-card__action:hover,
.info-card__action:focus-visible {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: 0 10px 22px -12px rgba(20, 120, 110, 0.5);
}

/* ===== Переключатель (switch) — напр. для 2FA ===== */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 48px;
  height: 27px;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(120, 122, 133, 0.45);
  cursor: pointer;
  text-shadow: none;
  transition: background 0.18s ease;
}

.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease;
}

.switch--on {
  background: var(--accent);
}

.switch--on .switch__knob {
  transform: translateX(21px);
}

.switch:focus-visible {
  outline: var(--focus-ring-width, 2px) solid var(--focus-ring);
  outline-offset: 3px;
}

.twofa-switch-form {
  margin: 0;
  display: inline-flex;
}

.twofa-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.twofa-label {
  font-weight: 650;
  font-size: 1.02rem;
}

.twofa-hint {
  margin: 0.75rem 0 0;
  color: var(--text-support);
  font-size: 0.92rem;
  line-height: 1.5;
}

.info-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.info-card__header h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.info-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(45, 212, 191, 0.16);
  border: 1px solid rgba(45, 212, 191, 0.28);
  color: #2dd4bf;
  flex: 0 0 auto;
}

html[data-theme="light"] .info-card__icon {
  color: var(--text);
  background: rgba(15, 118, 110, 0.10);
  border-color: rgba(15, 118, 110, 0.18);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border: 1px solid var(--border-subtle);
  background: var(--surface-well);
}

.status-pill--success {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.10);
}

.status-pill--danger {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.10);
}

.status-pill--warning {
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(217, 119, 6, 0.10);
}

.info-card__icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.glass-panel.profile-edit-panel {
  padding-bottom: 2.6rem;
}

.profile-edit-actions {
  margin-bottom: 1.1rem;
}

.info-card__body {
  display: grid;
  gap: 0.65rem;
}

.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.9rem;
}

.info-label {
  color: var(--text-faint);
  font-size: 0.95rem;
  white-space: nowrap;
}

.info-value {
  color: var(--text);
  font-weight: 650;
  text-align: right;
  overflow-wrap: anywhere;
}

.info-card__body--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
}

.info-card__body--inline .info-row {
  flex: 1 1 260px;
  min-width: 240px;
}

/* "Активность": field with a small leading icon, matching the card icons. */
.activity-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 260px;
  min-width: 240px;
}

.activity-item__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: rgba(45, 212, 191, 0.14);
  border: 1px solid rgba(45, 212, 191, 0.24);
  color: #2dd4bf;
}

.activity-item__icon svg {
  width: 20px;
  height: 20px;
}

.activity-item__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.activity-item__text .info-label {
  font-size: 0.85rem;
}

.activity-item__text .info-value {
  text-align: left;
}

html[data-theme="light"] .activity-item__icon {
  background: rgba(15, 118, 110, 0.10);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--accent);
}

/* Link shown in place of an empty value (e.g. "Добавить телефон"). */
.info-add-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.info-add-link:hover,
.info-add-link:focus-visible {
  text-decoration: underline;
}

@media (max-width: 575.98px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .info-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .info-value {
    text-align: left;
  }
}

/* Аватар-иконка и зелёная точка убраны (правки.docx). Кнопка редактирования
   профиля перенесена в строку с именем — поэтому позиционируется inline. */
.profile-title h1 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.profile-edit-fab--inline {
  position: relative;
  top: auto;
  right: auto;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.profile-edit-fab--inline .profile-edit-fab__tooltip {
  top: -42px;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

/* ===== Карточки устройств на /devices: фото слева, инфо справа ===== */
/* Одиночная карточка не растягивается на всю ширину (auto-fill хранит пустые треки). */
/* Устройства идут вертикальным списком (сверху вниз), каждая карточка на всю
   ширину — вся информация помещается без сжатия. */
/* Компактные карточки (по образцу «Ваши устройства» Google / Microsoft):
   min(100%, 420px) не даёт карточке вылезать за экран телефона. */
.devices-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  align-items: start;
}

/* Карточка не двигается при наведении — акцент вынесен на кнопки (ниже). */
.device-card--modern {
  position: relative;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 1rem;
  padding: 1.1rem;
  border-radius: 20px;
}

/* Левая колонка: фото устройства + статус под ним. */
.device-card__media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.device-card__media .device-status {
  justify-content: center;
}

/* Нейтральный стиль рамки — как у «Быстрые действия», без бирюзового канта. */
html[data-theme="light"] .device-card--modern {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.4);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 18px 40px -28px rgba(0, 0, 0, 0.22);
}

/* Фото устройства слева — небольшое, целиком (contain), не растягивается.
   404 не ломает вид — показывается мягкая бирюзовая подложка. */
.device-photo {
  width: 136px;
  height: 106px;
  flex: 0 0 auto;
  border-radius: 14px;
  background-color: #eef1f5;
  background-image: linear-gradient(140deg, rgba(41, 37, 31, 0.05), rgba(41, 37, 31, 0.02));
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(41, 37, 31, 0.06);
}

.device-photo--phone {
  background-image: url("/static/img/devices/phone.webp");
}

.device-photo--laptop {
  background-image: url("/static/img/devices/laptop.webp");
}

.device-photo--box {
  background-image: url("/static/img/devices/desktop.webp");
}

.device-photo--server {
  background-image: url("/static/img/devices/server.webp");
}

.device-photo--nas {
  background-image: url("/static/img/devices/nas.webp");
}

/* Правая колонка с информацией. position: relative — якорь для поповера
   переименования (открывается под строкой имени, не вылезая за карточку). */
.device-card__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 auto;
}

/* Верхняя строка: имя-заголовок и тихий карандаш переименования рядом с ним. */
.device-card__name-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
}

/* Имя устройства — заголовок карточки. */
.device-card__name {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Тип устройства — тихий подзаголовок под именем. */
.device-card__type {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-support);
}

.device-card__id-value {
  display: none;
}

.device-card__meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.device-card__chip {
  max-width: 100%;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  font-weight: 650;
  font-size: 0.92rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Занятое место на устройстве (данные появятся, когда агент подключится). */
.device-usage {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0.1rem 0;
}

.device-usage__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--text-support);
}

.device-usage__val {
  color: var(--text-faint);
  font-weight: 650;
}

.device-usage__track {
  height: 7px;
  border-radius: 999px;
  background: rgba(41, 37, 31, 0.08);
  overflow: hidden;
}

.device-usage__bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
}

/* Статус устройства (в сети / не в сети). */
.device-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--text-support);
  white-space: nowrap;
}

.device-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa0a6;
  box-shadow: 0 0 0 3px rgba(154, 160, 166, 0.18);
}

.device-status--online {
  color: #0f766e;
}

.device-status--online .device-status__dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Пилюля с типом устройства (в фирменной бирюзе исходной палитры). */
.device-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent-foreground);
  background: var(--accent-gradient);
  box-shadow: 0 8px 18px -8px rgba(20, 120, 110, 0.45);
}

/* ID устройства — тихая серая моно-строка внизу карточки (как в TeamViewer /
   Tailscale). Клик копирует полный идентификатор (site.js, data-copy-target). */
.device-card__id {
  align-self: flex-start;
  max-width: 100%;
  margin-top: 0.15rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.15s ease;
}

.device-card__id:hover,
.device-card__id:focus-visible {
  color: var(--accent);
}

.device-card--modern .device-card__footer {
  /* flex-direction: row перекрывает общий мобильный сброс в колонку
     (@media 991.98px, .device-card__footer) — кнопки остаются в ряд. */
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Кнопки карточки: эффект появляется при наведении именно на кнопку. */
.device-btn {
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

html[data-theme="light"] .device-btn:hover,
html[data-theme="light"] .device-btn:focus-visible {
  transform: translateY(-2px);
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 8px 18px -8px rgba(20, 120, 110, 0.45);
}

html[data-theme="light"] .device-btn--danger {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
}

html[data-theme="light"] .device-btn--danger:hover,
html[data-theme="light"] .device-btn--danger:focus-visible {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.09);
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 8px 18px -8px rgba(220, 38, 38, 0.4);
}

/* Переименование — тихий карандаш рядом с именем; форма-поповер раскрывается
   под строкой имени и позиционируется от .device-card__body (не вылезает за
   края карточки при любой длине имени). */
.device-rename {
  position: static;
  z-index: 4;
  display: inline-flex;
  flex: 0 0 auto;
}

.device-rename__toggle {
  list-style: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  color: var(--text-support);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.device-rename__toggle::-webkit-details-marker {
  display: none;
}

.device-rename__toggle::marker {
  content: "";
}

.device-rename__toggle svg {
  width: 15px;
  height: 15px;
}

.device-rename__toggle:hover {
  color: var(--accent);
  border-color: rgba(45, 212, 191, 0.5);
  background: rgba(45, 212, 191, 0.1);
}

.device-rename[open] .device-rename__toggle {
  color: var(--accent);
  border-color: var(--accent);
}

.device-rename__form {
  position: absolute;
  top: calc(1.5rem + 8px);
  left: 0;
  max-width: 100%;
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(20, 40, 60, 0.18);
}

.device-rename__input {
  width: 168px;
  max-width: 52vw;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.device-rename__input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Узкие экраны (телефон): складываем карточку в столбик, ничего не вылезает. */
@media (max-width: 520px) {
  .device-card--modern {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .device-card__media {
    width: 100%;
  }

  .device-photo {
    width: 100%;
    max-width: 200px;
    height: 120px;
    margin: 0 auto;
  }

  .device-card__name-row {
    justify-content: center;
    padding-right: 0;
  }

  .device-card__meta-row {
    justify-content: center;
  }

  .device-card--modern .device-card__footer {
    justify-content: center;
  }

  .device-card__id {
    align-self: center;
  }
}