/* ============================================================
   АГМК — база: сброс, типографика, шапка, меню, настройки, футер
   ============================================================ */

/* ---------- Сброс ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1,
h2,
h3,
h4 {
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 800;
  text-wrap: balance;
}

:focus-visible {
  outline: 3px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--brand-300);
  color: var(--text);
}

/* ---------- Служебное ---------- */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 300;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 16px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3.2vw, 2rem);
}

.container--narrow {
  max-width: 860px;
}

.section {
  padding-block: clamp(2.75rem, 6vw, 4.75rem);
}

.section--soft {
  background: var(--bg-soft);
  border-block: 1px solid var(--border);
}

.section__head {
  max-width: 720px;
  margin-bottom: clamp(1.75rem, 3.5vw, 2.75rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-600);
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.section__title {
  font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.1rem);
  margin-bottom: 0.7rem;
}

.section__lead {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 62ch;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  flex: 0 0 auto;
}

.btn--primary {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 12px 26px -14px rgba(55, 177, 161, 0.9);
}

.btn--primary:hover {
  background: var(--brand-700);
  box-shadow: 0 18px 34px -14px rgba(55, 177, 161, 0.85);
}

.btn--outline {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.btn--outline:hover {
  border-color: var(--brand);
  color: var(--brand-700);
  background: var(--accent-soft);
}

.btn--soft {
  background: var(--accent-soft);
  color: var(--brand-700);
}

.btn--soft:hover {
  background: var(--brand-100);
}

.btn--ghost {
  color: var(--text-muted);
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.84rem;
}

.btn--lg {
  padding: 0.9rem 1.7rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ---------- Верхняя полоса ---------- */
.topbar {
  background: var(--surface);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  transition: background-color 0.25s var(--ease);
}

.topbar__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--topbar-h);
}

.topbar__nav {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topbar__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.18s var(--ease);
}

.topbar__link > span {
  position: relative;
}

.topbar__link > span::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.85;
  transform: scaleX(0);
  transform-origin: left center;
  transition:
    transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.3s var(--ease);
}

.topbar__link:hover,
.topbar__link:focus-visible {
  color: var(--brand-700);
  background: transparent;
  text-decoration: none;
}

.topbar__link:hover > span::after,
.topbar__link:focus-visible > span::after {
  transform: scaleX(1);
}

.topbar__item--sub {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar__chev {
  width: 13px;
  height: 13px;
  transition: transform 0.2s var(--ease);
}

.topbar__item--sub.is-open .topbar__chev {
  transform: rotate(180deg);
}

.topbar__sub {
  position: absolute;
  top: 100%;
  left: -0.5rem;
  z-index: 120;
  width: max-content;
  min-width: min(26rem, calc(100vw - 2rem));
  max-width: min(54rem, calc(100vw - 2rem));
  margin: 0.35rem 0 0;
  padding: 0.5rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 4px 14px rgba(16, 42, 48, 0.08),
    0 34px 64px -32px rgba(16, 42, 48, 0.55);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.99);
  transform-origin: top left;
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease),
    transform 0.2s var(--ease),
    visibility 0.18s var(--ease);
}

.topbar__sub::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-brand);
}

/* «мостик», чтобы меню не закрывалось при переходе курсора */
.topbar__item--sub::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 0.55rem;
}

.topbar__item--sub:hover .topbar__sub,
.topbar__item--sub:focus-within .topbar__sub,
.topbar__item--sub.is-open .topbar__sub {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.topbar__item--sub:hover .topbar__chev,
.topbar__item--sub:focus-within .topbar__chev,
.topbar__item--sub.is-open .topbar__chev {
  transform: rotate(180deg);
}

.topbar__sublink {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.32rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 0.16s var(--ease),
    color 0.16s var(--ease),
    transform 0.18s var(--ease);
}

.topbar__sublink > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__sublink svg {
  box-sizing: content-box;
  width: 16px;
  height: 16px;
  padding: 0.32rem;
  flex: 0 0 auto;
  border-radius: var(--radius-xs);
  background: var(--brand-50);
  color: var(--brand-700);
  transition:
    background-color 0.18s var(--ease),
    color 0.18s var(--ease),
    transform 0.18s var(--ease);
}

.topbar__sublink:hover,
.topbar__sublink:focus-visible {
  background: var(--surface-2);
  color: var(--brand-700);
  text-decoration: none;
  transform: translateX(2px);
}

.topbar__sublink:hover svg,
.topbar__sublink:focus-visible svg {
  background: var(--brand-600);
  color: #ffffff;
  transform: scale(1.06);
}

.topbar__action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  margin-right: -0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.topbar__action:hover {
  color: var(--brand-700);
  background: var(--brand-50);
}

.topbar__action--icon {
  padding: 0.35rem;
  margin-right: 0.15rem;
}

.topbar__nav svg,
.topbar__action svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

/* ---------- Шапка ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
  min-height: var(--header-h);
}

/* Логотип */
.brand {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: var(--text);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius-xs);
  background: var(--brand-600);
  color: #fff;
}

.brand__mark svg {
  width: 26px;
  height: 26px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__name {
  display: block;
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand__name > span {
  display: block;
  white-space: nowrap;
}

.brand__sub {
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--text-muted);
}

/* Навигация */
.nav {
  grid-column: 2;
  justify-self: end;
}

.nav__list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
}

.nav__link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav__link[aria-current='page'] {
  color: var(--brand-700);
  background: var(--accent-soft);
}

/* Действия в шапке */
.header__actions {
  position: relative;
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
  flex: 0 0 auto;
}

/* Кнопка «Цифровая платформа» */
.btn--platform {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1rem;
  border-radius: var(--radius-xs);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn--platform svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    background-color 0.2s var(--ease);
}

.icon-btn:hover {
  color: var(--brand-700);
  border-color: var(--brand-300);
  background: var(--accent-soft);
}

.icon-btn[aria-expanded='true'] {
  color: var(--brand-700);
  border-color: var(--brand-300);
  background: var(--accent-soft);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.burger {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.burger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.28s var(--ease), opacity 0.2s var(--ease);
}

.burger[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}

.burger[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Панель настроек ---------- */
.settings {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(340px, calc(100vw - 2rem));
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 1.1rem;
  z-index: 70;
  animation: pop 0.18s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.settings[hidden] {
  display: none;
}

.settings__group {
  display: grid;
  gap: 0.5rem;
}

.settings__title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.segmented__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0.35rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.segmented__btn svg {
  width: 18px;
  height: 18px;
}

.segmented__btn:hover {
  color: var(--text);
}

.segmented__btn[aria-checked='true'],
.segmented__btn[aria-pressed='true'],
.segmented__btn.is-active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-xs);
}

.settings__contrast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  background: var(--surface-2);
}

.settings__contrast:hover {
  border-color: var(--brand);
  background: var(--accent-soft);
  color: var(--brand-700);
}

.settings__contrast svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.settings__reset {
  justify-self: start;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.15rem 0;
}

.settings__reset:hover {
  color: var(--brand-700);
}

/* ---------- Панель «для слабовидящих» ---------- */
.a11y {
  position: fixed;
  right: clamp(0.75rem, 3vw, 1.75rem);
  bottom: clamp(0.75rem, 3vw, 1.75rem);
  z-index: 200;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2 * clamp(0.75rem, 3vw, 1.75rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem;
  border: 2px solid var(--a11y-border, var(--border-strong));
  border-radius: var(--radius-lg);
  background: var(--a11y-surface, var(--surface));
  color: var(--a11y-text, var(--text));
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 0.9rem;
}

.a11y[hidden] {
  display: none;
}

.a11y__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.a11y__title {
  font-size: 0.95rem;
  font-weight: 800;
}

.a11y__close {
  width: 32px;
  height: 32px;
  border: 2px solid currentColor;
  border-radius: var(--radius-xs);
  line-height: 1;
  font-size: 1.15rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.a11y__row {
  display: grid;
  gap: 0.35rem;
}

.a11y__label {
  font-size: 0.8rem;
  font-weight: 700;
}

.a11y__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.a11y__btn {
  min-width: 46px;
  padding: 0.42rem 0.6rem;
  border: 2px solid currentColor;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.a11y__btn[aria-pressed='true'] {
  color: var(--a11y-surface, #fff);
  background: var(--a11y-text, #000);
}

.a11y__scheme {
  width: 54px;
  height: 34px;
  border: 2px solid currentColor;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.a11y__scheme--bw {
  background: #fff;
  color: #000;
}

.a11y__scheme--wb {
  background: #000;
  color: #fff;
}

.a11y__scheme--blue {
  background: #9dd1ff;
  color: #063462;
}

.a11y__scheme[aria-pressed='true'] {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.a11y__exit {
  width: 100%;
  padding: 0.6rem;
  border: 2px solid currentColor;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 700;
}

.a11y__hint {
  font-size: 0.74rem;
  opacity: 0.85;
}

/* ---------- Карточки и мелочи ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand-700);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge--outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.tag {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

/* ---------- Поля формы ---------- */
.field {
  display: grid;
  gap: 0.35rem;
}

.field__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
}

.field__control > svg {
  position: absolute;
  left: 0.85rem;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.92rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease);
}

.field__control .input {
  padding-left: 2.6rem;
}

.input::placeholder {
  color: var(--text-dim);
}

.input:hover {
  border-color: var(--brand-300);
}

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(23, 182, 168, 0.18);
}

.field__hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.field__error {
  display: none;
  font-size: 0.76rem;
  font-weight: 600;
  color: #c0342b;
}

[data-theme='dark'] .field__error {
  color: #ff9188;
}

.field.is-invalid .input {
  border-color: #d34a40;
  box-shadow: 0 0 0 4px rgba(211, 74, 64, 0.16);
}

.field.is-invalid .field__error {
  display: block;
}

.field__toggle {
  position: absolute;
  right: 0.4rem;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  color: var(--text-dim);
}

.field__toggle:hover {
  color: var(--brand-700);
  background: var(--accent-soft);
}

.field__toggle svg {
  width: 18px;
  height: 18px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.check input {
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  accent-color: var(--brand);
  flex: 0 0 auto;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid transparent;
}

.alert svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.alert--success {
  background: var(--accent-soft);
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.alert--info {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
}

.alert--error {
  background: rgba(211, 74, 64, 0.1);
  border-color: rgba(211, 74, 64, 0.42);
  color: #a3322a;
}

[data-theme='dark'] .alert--error {
  background: rgba(211, 74, 64, 0.16);
  color: #ffb3ad;
}

/* ---------- Футер ---------- */
.footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-top: clamp(2.25rem, 4vw, 3.25rem);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 2rem;
  padding-bottom: 2rem;
}

.footer__title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.footer__list {
  display: grid;
  gap: 0.5rem;
  font-size: 0.87rem;
}

.footer__list a,
.footer__text a {
  color: var(--text-muted);
}

.footer__list a:hover,
.footer__text a:hover {
  color: var(--brand-700);
  text-decoration: underline;
}

.footer__text {
  font-size: 0.87rem;
  color: var(--text-muted);
  max-width: 34ch;
}

.footer__text + .footer__text {
  margin-top: 0.6rem;
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.footer__bottom a {
  color: var(--text-dim);
}

.footer__bottom a:hover {
  color: var(--brand-700);
}

/* ---------- Страница: общий каркас ---------- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page__main {
  flex: 1 0 auto;
}

/* ---------- Адаптив шапки ---------- */
@media (max-width: 1180px) {
  .topbar__nav {
    gap: 1rem;
  }
}

@media (max-width: 1020px) {
  .topbar__link {
    font-size: 0.74rem;
  }

  .topbar__action span {
    display: none;
  }

  .topbar__action {
    padding: 0.4rem;
    margin-right: 0;
  }
}

@media (max-width: 1080px) {
  .brand__sub {
    display: none;
  }
}

@media (max-width: 940px) {
  .burger {
    display: flex;
  }

  .nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0.75rem clamp(1rem, 3.2vw, 2rem) 1rem;
    display: none;
    max-height: calc(100vh - var(--header-h));
    overflow: auto;
  }

  .nav.is-open {
    display: block;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .nav__link {
    padding: 0.7rem 0.6rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }

  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 68px;
  }

  .brand__name {
    font-size: 0.65rem;
    letter-spacing: 0.03em;
  }

  .topbar__nav li:not(:first-child) {
    display: none;
  }

  .btn--platform {
    display: none;
  }

  .brand__mark {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
  }

  .brand__mark svg {
    width: 22px;
    height: 22px;
  }

  .header__actions .btn--login {
    display: none;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer__bottom {
    justify-content: center;
    text-align: center;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
