/* Оболочка: шапка и нижняя панель на телефоне, боковая панель на компьютере (Дизайн-спека §3.3, §4.5, §5.5). */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(var(--h-topbar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: baseline;
  font: 800 1.75rem / 1 var(--f-display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.brand i {
  font-style: normal;
  color: var(--accent);
}
.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font: 700 1rem / 1 var(--f-text);
  color: var(--text);
  transition: transform var(--dur-press) var(--ease-out);
}
.avatar:active {
  transform: scale(0.97);
}
.main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-4) var(--gutter) var(--s-9);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}
.page__head {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.page__head p {
  color: var(--mute);
  max-width: 65ch;
}
.page__bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}
@media (max-width: 639px) {
  .page__bar .btn {
    width: 100%;
  }
}
.tabbar-wrap {
  flex: none;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
}

/* Боковая панель */
.side {
  display: none;
}

@media (min-width: 1024px) {
  .app {
    flex-direction: row;
  }
  .topbar,
  .tabbar-wrap {
    display: none;
  }
  .side {
    flex: none;
    width: var(--w-side);
    display: flex;
    flex-direction: column;
    padding: var(--s-6) var(--s-4) var(--s-5);
    border-right: 1px solid var(--line);
    background: var(--bg);
  }
  .side__brand {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 0 var(--s-2) var(--s-6);
  }
  .side__mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--r-s);
    background: var(--btn-fill);
    color: var(--accent-ink);
    font: 800 1.0625rem / 1 var(--f-display); /* «SMA» из трёх букв помещается в плитку 40 px с воздухом по краям */
    letter-spacing: 0.01em;
  }
  .side__brand .brand {
    font-size: 2rem;
  }
  .side__nav {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
  }
  .side__item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 48px;
    padding: 0 var(--s-4);
    border-radius: var(--r-s);
    color: var(--text-2);
    font: 500 var(--t-body) / 1.2 var(--f-text);
    text-align: left;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out);
  }
  .side__item .icon {
    color: var(--mute);
    transition: color var(--dur-fast) var(--ease-out);
  }
  .side__item:active {
    transform: scale(0.98);
  }
  @media (hover: hover) and (pointer: fine) {
    .side__item:hover {
      background: var(--surface);
      color: var(--text);
    }
  }
  .side__item[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--text);
  }
  .side__item[aria-current="page"] .icon {
    color: var(--accent-text);
  }
  .side__sep {
    height: 1px;
    margin: var(--s-3) var(--s-2);
    background: var(--line);
  }
  .side__user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-2) 0;
    border-top: 1px solid var(--line);
  }
  .side__me {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2);
    border-radius: var(--r-s);
    text-align: left;
    color: inherit;
  }
  .side__me:active {
    background: var(--surface);
  }
  @media (hover: hover) and (pointer: fine) {
    .side__me:hover {
      background: var(--surface);
    }
  }
  .side__who {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .side__who b {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .side__who span {
    font-size: var(--t-small);
    color: var(--mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .page {
    padding-top: var(--s-8);
  }
}

/* Заглушка раздела */
.stub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-4);
  padding: var(--pad-hero);
  max-width: 640px;
}
.stub-card .card__tile {
  width: 56px;
  height: 56px;
  border-radius: var(--r-m);
}
 @media (min-width: 1024px) {
  .stub-card {
    max-width: 760px;
    display: grid;
    grid-template-columns: 56px 1fr;
    column-gap: var(--s-5);
    row-gap: var(--s-2);
    align-items: start;
  }
  .stub-card .card__tile {
    grid-row: 1 / span 2;
  }
}
.stub-card p {
  color: var(--text-2);
  max-width: 52ch;
}

/* Баннер «нет связи» сдвигает контент вниз, а не перекрывает его */
.net-banner {
  flex: none;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--t-small);
  line-height: 1.43;
  padding: var(--s-2) var(--gutter);
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
/* Вторая полоса под «нет связи»: часы устройства врут, вышла новая версия. На экране созвона её нет (обновление ждёт конца созвона) */
.notice-banner {
  flex: none;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--t-small);
  line-height: 1.43;
  padding: var(--s-2) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.notice-banner[hidden] {
  display: none;
}
.notice-banner__row {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}
.notice-banner__row .btn {
  margin-left: auto;
}
body.on-call .notice-banner {
  display: none !important;
}
.main-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Шаги на экране приглашения: как открыть, куда ввести код, как добавить на «Домой» (Ж-129) */
.auth__steps {
  margin: 0 0 var(--s-3);
  padding: 0 0 0 var(--s-5);
  color: var(--text-2);
  font-size: var(--t-small);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
/* Проход А3: серые плашки состояния сервера (например «данные партнёрок старше 36 часов» в выходные) */
.notice-banner__row--info {
  color: var(--mute);
}
.notice-banner.is-info-only {
  background: var(--strip-bg);
}
