﻿:root {
  /*
    STYLE MAP: Общая тема личного кабинета Bedmah.

    Проект сейчас является статическим HTML/CSS/JS-прототипом.
    Этот файл держит все визуальные правила:
    - базовая темная тема;
    - шапка и мобильная нижняя навигация;
    - карточки, кнопки, формы;
    - раздел профилей WireGuard;
    - модалки QR/новостей;
    - главная страница с соцпанелью и новостями;
    - FAQ, профиль, приложение и auth-страница;
    - адаптив под мобильный и ПК.

    Важная идея адаптива:
    - mobile-first: базовые стили рассчитаны на телефон;
    - @media (min-width: 900px) усиливает desktop-композицию;
    - @media (max-width: 520px) поджимает элементы для маленьких экранов.

    Production notes:
    - Если проект станет больше, CSS лучше разделить на base/layout/components/pages.
    - Повторяющиеся inline style в HTML лучше вынести сюда.
    - Цвета уже собраны в CSS-переменные, их можно расширить под полноценную design system.
  */
  --bg: #040404;
  --shell: #0d0d0d;
  --shell-2: #141414;
  --line: #222222;
  --txt: #f2f2f2;
  --muted: #9a9a9a;
  --accent: #f4f4f4;
  --danger: #ff8f8f;
  --desktop-page-max: 1280px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, #030303, #090909);
  color: var(--txt);
  font-family: "Onest", "Segoe UI", sans-serif;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(180deg, #030303, #090909);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.app-ready .app-loader {
  opacity: 0;
  visibility: hidden;
}

.app-loader-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateY(0);
  animation: loaderRise 0.55s ease both;
}

.app-loader-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #2d2d2d;
  background: #111111;
  color: #f2f2f2;
  font-size: 13px;
  animation: loaderPulse 1.2s ease-in-out infinite;
}

.app-loader-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.app-loader-sub {
  color: var(--muted);
  font-size: 13px;
}

.layout { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }

/* Header map:
   Sticky desktop/mobile header. On desktop it shows main navigation plus account icons.
   On mobile only account icons remain in the top header, while section navigation moves to .footnav. */
.header {
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  width: min(100% - 24px, 1240px);
  margin: 0 auto;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
}

.logo::before {
  content: "◆";
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
}

.logo-stack {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
}

.logo-main {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f3f3f3;
}

.logo-sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #c3c3c3;
}

.topnav { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn-top {
  padding: 7px 10px;
  font-size: 12px;
  background: #121212;
  color: var(--txt);
}
.btn-top.active {
  background: #efefef;
  color: #070707;
  border-color: transparent;
}

.top-icon-btn {
  min-width: 34px;
  min-height: 32px;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-icon {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.top-icon-btn.active .top-icon {
  filter: brightness(0) invert(0);
  opacity: 0.9;
}

.main {
  width: min(100% - 24px, 1240px);
  margin: 10px auto 8px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.shell {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0d0d0d, #111111);
  min-width: 0;
  width: 100%;
}

.shell-head { padding: 14px; border-bottom: 1px solid var(--line); }
.h1 { margin: 0; font-size: clamp(24px, 4.5vw, 34px); line-height: 1.1; }
.section-title { font-size: 24px; }
.sub { margin-top: 7px; color: var(--muted); font-size: 13px; }

.actions { padding: 12px 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Button map:
   .btn is the shared primitive for links and buttons.
   Page-specific classes only adjust size/importance, so hover/disabled behavior stays consistent. */
.btn {
  border: 1px solid var(--line);
  background: var(--shell-2);
  color: var(--txt);
  padding: 11px 13px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}
.btn:hover {
  border-color: #333;
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #2a2a2a;
}
.btn-main {
  background: #efefef;
  color: #070707;
  border-color: transparent;
  font-weight: 700;
}
.btn-main:hover { background: #ffffff; }
.btn-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.btn.is-loading {
  position: relative;
  opacity: 0.78;
  cursor: progress;
}

.btn.is-loading::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: 8px;
  display: inline-block;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-mini {
  padding: 8px 10px;
  font-size: 12px;
  min-height: 36px;
}

.create-stack {
  width: 100%;
  display: grid;
  gap: 7px;
}

.create-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.create-row-single {
  grid-template-columns: 1fr;
}

.create-link {
  display: inline-block;
  padding: 2px 0;
  font-size: 13px;
  color: #cfcfcf;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.create-link:hover {
  color: #ffffff;
}

.limit-row {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.limit-row .sub {
  margin: 0;
}


.content { padding: 14px; min-width: 0; }

.grid-2, .grid-4 { display: grid; gap: 10px; }
.card {
  border: 1px solid var(--line);
  background: #121212;
  padding: 12px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.card:hover {
  border-color: #303030;
}
.label { color: var(--muted); font-size: 12px; }
.value { margin-top: 6px; font-size: 20px; font-family: "JetBrains Mono", monospace; }

.table-box { border: 1px solid var(--line); overflow-x: auto; max-width: 100%; }
table { width: 100%; min-width: 520px; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid #1e1e1e; font-size: 12px; text-align: left; }
th { background: #171717; color: #bcbcbc; font-weight: 500; }

/* Profiles map:
   These styles support wg.html: list of profiles, selected state, region badge,
   empty-state and configuration preview/code output. */
.config-list { display: grid; gap: 8px; }
.config-item {
  border: 1px solid var(--line);
  background: #131313;
  color: var(--txt);
  padding: 12px;
  min-height: 64px;
  cursor: pointer;
  animation: softItemIn 0.22s ease both;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.config-item:hover {
  border-color: #3a3a3a;
  transform: translateY(-1px);
}
.config-item.active {
  background: #efefef;
  color: #070707;
  border-color: #efefef;
  box-shadow: 0 12px 34px rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}
.config-item-name { font-size: 17px; font-weight: 800; line-height: 1.15; }
.config-item-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.config-item.active .config-item-sub { color: #4a4a4a; }
.config-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.config-item-region {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #343434;
  background: #111111;
  color: #cfcfcf;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.config-item.active .config-item-region {
  background: #dbdbdb;
  border-color: #dbdbdb;
  color: #111111;
}
.config-empty {
  border: 1px dashed #333;
  background: #101010;
  color: #c8c8c8;
  padding: 12px;
  font-size: 13px;
  line-height: 1.4;
  animation: softItemIn 0.22s ease both;
}

#selected-config-shell {
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#selected-config-shell.has-selected-config {
  border-color: #313131;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
}

#config-detail-empty,
#config-detail-active {
  animation: detailIn 0.24s ease both;
}

.code {
  border: 1px solid #3a3a3a;
  background: #000000;
  color: #f4f7fb;
  padding: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 100%;
}

/* Modal map:
   QR modal is used by the profile preview flow.
   News modal later reuses the same visual language but has separate classes. */
.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.qr-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.qr-modal-card {
  width: min(100%, 520px);
  border: 1px solid #3a3a3a;
  background: #050505;
  padding: 14px;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.qr-modal.open .qr-modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.qr-canvas-large {
  width: min(100%, 420px);
  aspect-ratio: 1/1;
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  background: #fff;
}

.tab-pane { display: none; min-width: 0; }
.tab-pane.active { display: block; }

.field { margin-bottom: 8px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: var(--txt);
  padding: 10px;
  font: inherit;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: #4a4a4a;
  background: #0f0f0f;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

/* Mobile navigation map:
   Bottom navigation is the primary section switcher on phones.
   It is hidden on desktop in the min-width: 900px media query. */
.footnav {
  border-top: 1px solid var(--line);
  background: #0b0b0b;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  position: sticky;
  bottom: 0;
  z-index: 40;
  min-height: 82px;
}

.footnav a, .footnav button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 18px 6px;
  font-size: 13px;
  min-height: 82px;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.footnav a.active, .footnav button.active {
  background: #151515;
  color: var(--txt);
}

.footnav-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  gap: 3px;
}

.footnav-label-main {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b5b5b5;
}

.footnav-label-sub {
  font-size: 15px;
  font-weight: 700;
  color: #d8d8d8;
}

.footnav a:hover .footnav-label-main {
  color: #c8c8c8;
}

.footnav a.active .footnav-label-sub {
  color: #f1f1f1;
}

.footnav a.active .footnav-label-main {
  color: #cfcfcf;
}
.footnav-app-title {
  letter-spacing: -0.01em;
}

/* Home page map:
   Main page is composed of quick-entry cards, social links and news.
   Base rules are mobile-first; desktop layout is reshaped near the bottom of the file. */
.home-shell { display: grid; grid-template-rows: 1fr; }
.home-content { padding: 10px; }
.home-clean { padding: 10px; }
.home-clean-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.home-clean-card {
  border: 1px solid #272727;
  background: linear-gradient(180deg, #131313, #101010);
  padding: 10px;
  min-height: 90px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 6px;
}
.home-clean-title { font-size: 14px; font-weight: 800; color: #f2f2f2; }
.home-clean-text { font-size: 12px; line-height: 1.35; color: #c4c4c4; }
/* Social panel map:
   Social buttons intentionally use square icon tiles.
   On desktop they form a horizontal action strip; on small screens they remain compact. */
.home-social-actions {
  display: grid;
  --social-size: 56px;
  grid-template-columns: repeat(4, var(--social-size));
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.home-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--social-size);
  height: var(--social-size);
  min-height: var(--social-size);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.social-icon-btn {
  padding: 7px;
  border-color: #303030;
  background: radial-gradient(circle at 50% 18%, #242424, #111111 68%);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(0, 0, 0, 0.18);
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.social-icon-btn:hover {
  transform: translateY(-1px);
  border-color: #454545;
  background: radial-gradient(circle at 50% 18%, #2b2b2b, #151515 68%);
}

.social-icon {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
}

.home-social-btn .social-icon {
  width: 34px;
  height: 34px;
}

.social-bot-btn {
  flex-direction: column;
  gap: 5px;
}

.home-social-btn.social-bot-btn .social-icon {
  width: 28px;
  height: 28px;
}

.social-icon-caption {
  display: block;
  font-size: 11px;
  line-height: 1.05;
  font-weight: 700;
  color: #cfcfcf;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.faq-support-btn .social-icon {
  width: 34px;
  height: 34px;
}
.home-section-offset { margin-top: 8px; }
.home-title-lg {
  font-size: 18px;
  line-height: 1.1;
}
/* News map:
   News cards are clickable buttons. Only the latest 5 are visible until "Показать все".
   Read/unread state is visual in this prototype and controlled by index.html JS. */
.news-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.news-title {
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0;
}
.news-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.news-action-btn {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 11px;
  white-space: nowrap;
}
.news-show-all-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}
.news-grid { margin-top: 10px; }
.news-card {
  width: 100%;
  min-height: 104px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 5px;
  border-radius: 8px;
  animation: softItemIn 0.24s ease both;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.news-card:hover {
  transform: translateY(-2px);
  border-color: #3f3f3f;
  background: #171717;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
}
.news-card.read {
  opacity: 0.58;
}
.news-card.read .news-status {
  border-color: #2b2b2b;
  background: #101010;
  color: #9f9f9f;
}
.news-card-hidden {
  display: none !important;
}
.news-card-title {
  font-size: 15px;
  line-height: 1.15;
  font-weight: 800;
  color: #f2f2f2;
}
.news-text {
  margin-top: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #c8c8c8;
}
.news-status {
  width: fit-content;
  margin-top: 4px;
  padding: 3px 7px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  background: #181818;
  color: #eeeeee;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}
.news-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.news-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.news-modal-card {
  position: relative;
  width: min(100%, 440px);
  border: 1px solid #343434;
  border-radius: 8px;
  background: linear-gradient(180deg, #141414, #0d0d0d);
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.news-modal.open .news-modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.news-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid #2d2d2d;
  border-radius: 8px;
  background: #101010;
  color: #eeeeee;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.news-modal-close:hover {
  border-color: #4a4a4a;
  background: #181818;
}
.news-modal-title {
  margin: 8px 36px 0 0;
  font-size: 22px;
  line-height: 1.12;
}
.news-modal-text {
  margin: 12px 0 0;
  color: #d2d2d2;
  line-height: 1.5;
  font-size: 14px;
}
.news-text-link {
  color: #ffffff;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.news-text-link:hover {
  color: #cfcfcf;
}
.news-modal-read {
  width: 100%;
  margin-top: 18px;
  min-height: 46px;
}
/* FAQ map:
   FAQ support panel mirrors the home social panel so support links feel consistent
   across the product. Useful links are still simple placeholders. */
.faq-section { margin-top: 16px; }
.faq-section:first-child { margin-top: 0; }

.faq-title {
  font-size: 13px;
  margin-bottom: 8px;
}

.faq-support-panel {
  border: 1px solid #272727;
  background: linear-gradient(180deg, #131313, #101010);
  border-radius: 8px;
  padding: 12px;
}

.faq-support-title {
  margin-bottom: 12px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
  color: #f2f2f2;
}

.faq-useful-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.faq-useful-btn {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.faq-json-link {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: min(100%, 220px);
  text-align: left;
  white-space: normal;
}
.faq-json-link span {
  font-weight: 800;
}
.faq-json-link small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.faq-support-row {
  display: grid;
  --social-size: 56px;
  grid-template-columns: repeat(3, var(--social-size));
  justify-content: start;
  gap: 8px;
}

.faq-support-btn {
  width: var(--social-size);
  height: var(--social-size);
  min-height: var(--social-size);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.profile-section { margin-bottom: 10px; }
.profile-title {
  font-size: 16px;
  font-weight: 700;
  color: #f2f2f2;
}
.profile-text { margin-top: 6px; }
.proxy-text { margin-top: 6px; }
.app-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.app-meta-date {
  font-size: 16px;
}

.app-platform-name {
  font-size: 16px;
  font-weight: 700;
  color: #f2f2f2;
}

.app-platform-ext {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.app-platform-desc {
  font-size: 12px;
  color: #9a9a9a;
  line-height: 1.35;
  margin-top: 3px;
}

.app-recommended-badge {
  flex: 0 0 auto;
  border: 1px solid #3a3a3a;
  background: #ededed;
  color: #080808;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.app-win-card {
  margin-top: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-win-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.app-dl-btn {
  width: 100%;
  text-align: center;
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
}

.app-download-message {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 193, 7, 0.24);
  background: rgba(255, 193, 7, 0.08);
  color: #e2c15e;
  font-size: 13px;
  line-height: 1.4;
}

.alt-apps-copy {
  min-width: 0;
  display: block;
}

.alt-apps-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.alt-apps-toggle:hover {
  background: rgba(255, 255, 255, 0.02);
}

.alt-apps-title {
  display: block;
  font-size: 20px;
}

.alt-apps-chevron {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--shell-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 18px;
  transition: transform 0.16s ease;
}

.alt-apps-toggle[aria-expanded="true"] .alt-apps-chevron {
  transform: rotate(180deg);
}

.alt-apps-content {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 0.26s ease, opacity 0.2s ease, transform 0.2s ease;
}

.alt-apps-content.open {
  opacity: 1;
  transform: translateY(0);
}

.app-other-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  animation: softItemIn 0.24s ease both;
}

.app-other-card + .app-other-card {
  margin-top: 10px;
}

.app-other-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.app-other-head-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.app-official-link {
  width: fit-content;
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-decoration: none;
  border-bottom: 1px solid rgba(47, 112, 255, 0.28);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.app-official-link:hover {
  color: var(--accent-strong);
  border-color: currentColor;
}

.app-official-link.is-unavailable {
  pointer-events: none;
  color: var(--muted);
  border-color: transparent;
}

.app-other-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.app-other-btn {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.app-other-btn-label,
.app-other-btn-status {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}

.app-other-btn-status {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.app-other-btn.is-unavailable {
  min-height: 54px;
  opacity: 0.62;
}

.app-platform-group {
  border: 1px solid #292929;
  background: #121212;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 86px;
  align-content: stretch;
}

.app-platform-group-title {
  font-size: 13px;
  line-height: 1.1;
  font-weight: 800;
  color: #e2e2e2;
  text-align: center;
}

.app-platform-group-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.app-platform-group-actions.single-link {
  grid-template-columns: 1fr;
}

.app-platform-group .app-other-btn {
  min-height: 42px;
  padding: 8px;
  font-size: 12px;
  border-radius: 7px;
}

@media (min-width: 780px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .app-other-actions { grid-template-columns: repeat(4, 1fr); }
}

/* Compact-height map:
   Helps the mobile cabinet fit on short screens by reducing card padding and allowing
   the home content to scroll inside the available viewport. Desktop overrides disable
   the unwanted internal scrollbar. */
@media (max-height: 760px) {
  .cabinet-page .main { min-height: calc(100vh - 62px - 70px - 18px); }
  .home-content {
    max-height: calc(100vh - 62px - 70px - 52px);
    overflow-y: auto;
  }
  .home-clean-card {
    min-height: 80px;
    padding: 8px;
    gap: 4px;
  }
  .home-clean-title { font-size: 13px; }
  .home-clean-text { font-size: 11px; line-height: 1.3; }
}

/* Small-phone map:
   Tightens header, main gutters, footer navigation and social button spacing
   for narrow screens. */
@media (max-width: 520px) {
  .logo::before { font-size: 11px; }
  .logo-main { font-size: 14px; }
  .logo-sub { font-size: 11px; }
  .header-inner {
    min-height: 56px;
    width: min(100% - 16px, 1240px);
  }
  .main {
    width: min(100% - 16px, 1240px);
    margin-top: 8px;
  }
  .footnav {
    min-height: 72px;
  }
  .footnav a, .footnav button {
    min-height: 72px;
    padding: 12px 4px;
    font-size: 12px;
  }
  .footnav-home-title {
    font-size: 12px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }
  .footnav-app-title {
    font-size: 11px;
  }
  .home-social-actions {
    --social-size: 52px;
    gap: 6px;
  }
  .app-other-head {
    display: grid;
    justify-items: start;
    gap: 8px;
  }
  .app-other-head-actions {
    justify-content: flex-start;
  }
  .alt-apps-toggle {
    align-items: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .alt-apps-title {
    font-size: 18px;
  }
  .app-recommended-badge {
    max-width: 100%;
  }
  .app-other-actions {
    grid-template-columns: 1fr;
  }
  .app-platform-group {
    min-height: auto;
  }
}


.footnav-home-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  font-size: 15px;
  font-weight: 700;
  color: #f0f0f0;
}
.footnav a.active .footnav-home-title {
  color: #ffffff;
}

/* ─── Desktop navigation ─────────────────────────────────── */

.topnav-main { display: none; }

/* Desktop map:
   This is where mobile-first blocks become desktop compositions:
   - topnav-main appears and footnav disappears;
   - regular pages get a calmer max-width;
   - home social panel becomes title-left/actions-right;
   - WG profiles become list + detail columns;
   - FAQ support panel becomes a horizontal support bar. */
@media (min-width: 900px) {
  .topnav-main {
    display: inline-flex;
    gap: 2px;
  }

  .footnav { display: none; }

  .layout { grid-template-rows: auto 1fr; }

  .header-inner { gap: 14px; min-height: 66px; }

  .header-inner {
    width: min(100% - 48px, var(--desktop-page-max));
  }

  .main {
    margin-top: 20px;
    margin-bottom: 28px;
    gap: 12px;
    width: min(100% - 48px, var(--desktop-page-max));
    align-items: stretch;
  }

  .cabinet-page .main {
    min-height: auto;
  }

  .shell-head { padding: 20px 24px; }
  .content { padding: 20px 24px; }
  .actions { padding: 16px 24px; }

  .home-clean-grid { grid-template-columns: repeat(4, 1fr); }

  .home-clean-card { min-height: 110px; padding: 14px; }
  .home-clean-grid .home-clean-title { font-size: 19px; }
  .home-clean-grid .home-clean-text { font-size: 16px; }

  .home-title-lg {
    font-size: 20px;
  }

  .news-title {
    font-size: 28px;
  }

  .home-clean {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 12px;
    max-height: none;
    overflow: visible;
  }

  .home-clean-grid {
    grid-column: 1 / -1;
  }

  .home-section-offset {
    margin-top: 0;
  }

  .home-clean-social {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 1;
    grid-row: 2;
    min-height: auto;
    gap: 18px;
  }

  .home-social-actions {
    --social-size: 60px;
    width: auto;
    min-width: calc(var(--social-size) * 4 + 30px);
    justify-content: end;
    margin-top: 0;
  }

  .home-social-btn {
    width: var(--social-size);
    height: var(--social-size);
    min-height: var(--social-size);
  }

  .home-news-section {
    grid-column: 1;
    grid-row: 3;
  }

  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .news-show-all-btn {
    width: auto;
    min-width: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
  }

  .faq-support-row {
    --social-size: 60px;
    max-width: none;
  }

  .faq-support-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
  }

  .faq-support-title {
    margin-bottom: 0;
    font-size: 20px;
  }

  .app-dl-btn {
    width: auto;
    min-width: 220px;
    align-self: flex-start;
  }

  .app-other-card { width: 100%; }

  /* WG page: profile list + detail side by side */
  .wg-page .main {
    width: min(100% - 48px, var(--desktop-page-max));
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
  }

  .wg-page #selected-config-shell.is-empty {
    display: block !important;
  }

  .wg-page #selected-config-shell.is-empty > .shell-head,
  .wg-page #selected-config-shell.is-empty > .content {
    display: none;
  }

  /* Profile page: two info cards side by side */
  .profile-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }

  .profile-section { margin-bottom: 0; }

  /* QR modal wider on desktop */
  .qr-modal-card { width: min(100%, 580px); padding: 20px; }
  .qr-canvas-large { width: min(100%, 480px); }
}

/* Large desktop map:
   Стратегия масштабирования под широкие экраны:
   - 1600px: расширяем max-width без zoom — ловит 2K при 150% DPI (≈1707px CSS)
   - 2000px: zoom 1.15 — ловит 2K при 125% DPI (≈2048px CSS) и 100% DPI
   - 2400px: zoom 1.25 — 2K при 100% DPI (2560px), 4K при 150%+
   - 3400px: zoom 1.45 — 4K при 100-125% DPI */
@media (min-width: 1600px) {
  :root {
    --desktop-page-max: 1360px;
  }
}

@media (min-width: 2000px) {
  :root {
    --desktop-page-max: 1440px;
  }

  body {
    zoom: 1.15;
  }

  .app-other-card { width: 100%; }
}

@media (min-width: 2400px) {
  :root {
    --desktop-page-max: 1480px;
  }

  body {
    zoom: 1.25;
  }

  .app-other-card { width: 100%; }
}

@media (min-width: 3400px) {
  :root {
    --desktop-page-max: 1520px;
  }

  body {
    zoom: 1.45;
  }
}

/* ─── Auth / login page ──────────────────────────────────── */

/* Auth page map:
   Standalone centered login screen. It does not use the cabinet layout because
   unauthenticated users should not see the full app navigation. */
.auth-page {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.auth-layout {
  width: min(100%, 400px);
  display: grid;
  gap: 18px;
  transform: translateY(-5vh);
}

.auth-logo-wrap {
  display: flex;
  justify-content: center;
}

.auth-logo::before { font-size: 18px; }

.auth-logo .logo-main {
  font-size: 32px;
  letter-spacing: 0.06em;
}

.auth-logo .logo-sub {
  margin-top: 5px;
  font-size: 14px;
  letter-spacing: 0.05em;
}

.auth-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0d0d0d, #111111);
  display: grid;
  gap: 0;
}

.auth-card-head {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.auth-title {
  font-size: 18px;
  font-weight: 700;
  color: #f2f2f2;
}

.auth-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.auth-fields {
  padding: 16px 20px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.auth-fields .field { margin-bottom: 0; }

.auth-actions {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.auth-actions .btn-main {
  width: 100%;
  text-align: center;
  min-height: 48px;
  font-size: 15px;
}

.auth-footer {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-footer-label {
  font-size: 12px;
  color: var(--muted);
}

.auth-footer-link {
  font-size: 13px;
  color: #cfcfcf;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-footer-link:hover { color: #ffffff; }

.auth-error {
  padding: 10px 20px;
  background: rgba(255, 143, 143, 0.06);
  border-bottom: 1px solid rgba(255, 143, 143, 0.15);
  font-size: 13px;
  color: var(--danger);
  display: none;
}

.auth-error.visible { display: block; }

.auth-support {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0d0d0d, #111111);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.auth-support .faq-support-row {
  justify-content: center;
  --social-size: 56px;
}

.auth-support .faq-support-btn {
  width: var(--social-size);
  height: var(--social-size);
  min-height: var(--social-size);
}

.auth-home-btn {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.auth-home-btn:hover { color: var(--txt); }

.auth-support-label {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #b0b0b0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page { display: none; }
.page.active {
  display: block;
  animation: pageEnter 0.22s ease both;
}
.topnav button, .footnav button, .as-button {
  font-family: inherit;
}
.topnav-user form { margin: 0; }
.as-button {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.as-button:hover { border-color: #3a3a3a; }
.notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 90;
  width: min(calc(100% - 24px), 420px);
  transform: translateX(-50%) translateY(12px);
  border: 1px solid #2f3d2f;
  border-radius: 8px;
  background: #101b12;
  color: #c8f2ce;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.notice.notice-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.notice.notice-leave {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

@keyframes loaderRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loaderPulse {
  0%, 100% {
    transform: scale(1);
    border-color: #2d2d2d;
  }
  50% {
    transform: scale(1.06);
    border-color: #5a5a5a;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes detailIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softItemIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
.notice.error {
  border-color: rgba(255,143,143,0.28);
  background: rgba(255,143,143,0.08);
  color: var(--danger);
}
.wg-layout {
  display: grid;
  gap: 8px;
}
.inline-actions {
  padding: 0;
  margin-bottom: 8px;
}
.create-row input {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: var(--txt);
  padding: 10px;
  font: inherit;
}
.profile-create-row {
  grid-template-columns: 1fr;
}
.profile-create-row #new-config-name {
  min-height: 46px;
}
.profile-create-row #create-config-btn {
  width: 100%;
  min-height: 46px;
}
.autofill-decoy {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.modal-head {
  padding: 0 0 10px 0;
  border-bottom: 1px solid var(--line);
}
.modal-content { padding: 12px 0 0 0; }
#qr-image {
  object-fit: contain;
  padding: 12px;
}
#modal-copy-hint { color: #9a9a9a; }
.empty-detail-head {
  border-bottom: 0;
  padding-bottom: 18px;
}
.empty-detail-head .section-title {
  color: var(--muted);
}
.auth-card { width: 100%; }
.auth-error.visible { display: block; }

@media (min-width: 900px) {
  .wg-layout {
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
  }
}

@media (max-width: 520px) {
  .auth-page {
    padding: 10px;
    place-items: center;
  }
  .auth-layout {
    gap: 12px;
    transform: translateY(0);
  }
  .auth-logo .logo-main {
    font-size: 26px;
  }
  .auth-logo .logo-sub {
    font-size: 12px;
  }
  .auth-card-head,
  .auth-fields,
  .auth-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
  .auth-support {
    padding: 10px;
  }
  .notice {
    bottom: 86px;
    width: min(calc(100% - 16px), 420px);
  }
}
