/* Стили паспорта. Перенесены из «passport (2).html»: картинки вынесены в static/img, шрифты — в static/fonts. */
/* ---------- Тёмная тема (по умолчанию) ---------- */
  :root {
    --bg: #000;
    --text: #f2f2f2;
    --icon: #8492a8;
    --icon-active: rgba(255, 255, 255, .1);
    --round-btn: transparent;     /* круглая подложка кнопки «поделиться» — есть только в светлой */

    --card: #f1e5e5;
    --card-head: #8a2229;
    --number: #8e2023;
    --label: #474c5c;
    --value: #2a2a2e;
    --crest: #eddada;
    --photo-bg: #dfd9dd;
    --link: #2f7fe6;

    --btn: #3c81f6;
    --btn-active: #2a62cc;
    --btn-outline: #3c81f6;
    --btn-outline-text: #427ef6;

    --overlay: rgba(0, 0, 0, .6);
    --sheet: #1a1a1c;
    --sheet-handle: #3a3a3c;
    --frame-border: transparent;
    --toast: #2f2f34;
    --install-sub: #9a9aa2;

    /* экран «Детали документа» */
    --d-bg: #000;
    --d-card: #28292e;
    --d-label: #9ea7b8;
    --d-value: #eae7ee;
    --d-link: #3c84fa;
    --d-dash: #41679f;
    --d-chevron: #8c8e9a;
    --d-line: #3a3b41;
    --d-active: #303138;
    --d-card-shadow: none;
    --d-faq: #28292e;

    /* статьи «Популярные вопросы» */
    --a-bg: #000;
    --a-text: #f0eef3;
    --a-title: #f3f1f6;
    --a-h3: #fff;
    --a-close: #3c82f2;
    --a-link: #3c80fd;
    --a-bullet: #5781ed;
    --a-box: #222127;
    --a-rate-border: #3b3a40;
    --a-rate-icon: #d8d8de;
    --a-card: #26252b;
    --a-card-link: #3e84f4;
    --a-banner: linear-gradient(90deg, #5571cc, #7b9be3);
    --a-contact: #26252b;
    --a-contact-shadow: none;
    --a-contact-text: #fff;
    --a-phone: #3e84f4;
    --a-chevron: #8c8e9a;

    /* диалог выбора способа добавления */
    --dim: rgba(0, 0, 0, .32);
    --dlg: #111;
    --dlg-line: #343436;
    --dlg-head: #aaacbb;
    --dlg-text: #eeebf2;

    /* выпадающее меню (три точки) */
    --popup: #2b2c31;
    --popup-text: #f0f1f6;
    --popup-shadow: 0 .4rem 1.8rem rgba(0, 0, 0, .55);

    /* главная (экран приложения, по замерам со скринов) */
    --m-bg: linear-gradient(180deg, #030409 0, #010409 10rem, #02060d 13.6rem, #030711 16rem, #040813 18.4rem, #030917 20.8rem, #030a1a 23.2rem, #050c1e 25.6rem, #040c1f 28rem, #030e22 30.4rem, #051026 32.8rem, #061029 35.2rem, #06122c 37.6rem, #061127 40rem, #050d22 42.4rem, #030a1a 44.8rem, #010713 47.2rem, #02050d 49.6rem, #010206 52rem, #000 56rem, #000 84rem);
    --m-head: #030409;
    --m-card: #292a2f;
    --m-title: #f7f2f9;
    --m-label: #f7f2f9;
    --m-note: #a7b0c1;
    --m-note-line: rgba(255, 255, 255, .1);
    --m-line: #3a3d45;
    --m-svc-bg: #292a2f;
    --m-chip: rgba(255, 255, 255, .11);
    --m-balance: rgba(255, 255, 255, .07);
    --m-balance-line: rgba(255, 255, 255, .12);
    --m-ring: #4a80e4;
    --m-tab: #232329;
    --m-tabline: rgba(255, 255, 255, .06);
    --m-pill: #35363b;
    --m-tab-on: #4289ff;
    --m-tab-off: #afb3bf;
    --m-promo-top: 16.03rem;
    --m-bal-top: 28.53rem;
    --m-docs-top: 39.06rem;
    --m-docs-h: 14.8rem;
    --m-svc-top: 54.75rem;
    --m-svc-h: 14.8rem;
    --m-note-top: 72.6rem;
  }

  /* ---------- Светлая тема: включается сама, если на устройстве светлая тема ---------- */
  @media (prefers-color-scheme: light) {
    :root {
      --bg: #fff;
      --text: #111;
      --icon: #747a84;
      --icon-active: rgba(0, 0, 0, .06);
      --round-btn: #e4e4e8;

      --card: #f8e6e6;
      --card-head: #a80021;
      --number: #a60123;
      --label: #504a4e;
      --value: #1e1a1c;
      --crest: #f5dbda;
      --photo-bg: #e5dae0;
      --link: #005bcd;

      --btn: #005bcd;
      --btn-active: #004aa8;
      --btn-outline: #005bcd;
      --btn-outline-text: #005bcd;

      --overlay: rgba(0, 0, 0, .5);
      --sheet: #fff;
      --sheet-handle: #d5d5d5;
      --frame-border: #e9efef;
      --install-sub: #5e6773;

      --d-bg: #fafafa;
      --d-card: #fff;
      --d-card-shadow: 0 .1rem .8rem rgba(0, 0, 0, .07);
      --d-faq: #f2f5fc;
      --d-label: #4b525a;
      --d-value: #161616;
      --d-link: #1a5bb8;
      --d-dash: #b9d0ee;
      --d-chevron: #8a94a3;
      --d-line: #eceef1;
      --d-active: #f2f4f7;

      --a-bg: #fff;
      --a-text: #1a1a1a;
      --a-title: #0e0e0e;
      --a-h3: #15477c;
      --a-close: #1a4fb0;
      --a-link: #1a56c9;
      --a-bullet: #5282e6;
      --a-box: transparent;
      --a-rate-border: #e8eaef;
      --a-rate-icon: #7c808b;
      --a-card: #f3f6fb;
      --a-card-link: #1755c2;
      --a-banner: linear-gradient(90deg, #5179db, #7ca9fe);
      --a-contact: #fff;
      --a-contact-shadow: 0 .1rem .8rem rgba(0, 0, 0, .08);
      --a-contact-text: #0c0c0c;
      --a-phone: #2b59b9;
      --a-chevron: #787f89;

      --dlg: #fff;
      --dlg-line: #e8e8e8;
      --dlg-head: #4f5259;
      --dlg-text: #0a0a0a;

      --popup: #fff;
      --popup-text: #0d0d0d;
      --popup-shadow: 0 .2rem 1.4rem rgba(0, 0, 0, .14);

      /* главная (экран приложения, по замерам со скринов) */
      --m-bg: linear-gradient(180deg, #021a4a 0, #021a4a 4rem, #031b4d 12rem, #062158 16rem, #092861 20rem, #0d2c6c 24rem, #0e3175 28rem, #113780 32rem, #153c89 36rem, #174193 40rem, #4e6eab 44rem, #8499c4 48rem, #bbc5de 52rem, #f3f4f9 56rem, #fefefe 60rem, #fefefe 84rem);
      --m-head: #021a4a;
      --m-card: #fefefe;
      --m-title: #090909;
      --m-label: #090909;
      --m-note: #4c5461;
      --m-note-line: #e3e6eb;
      --m-line: #eaebed;
      --m-svc-bg: #fefefe;
      --m-chip: rgba(255, 255, 255, .11);
      --m-balance: rgba(255, 255, 255, .13);
      --m-balance-line: rgba(255, 255, 255, .18);
      --m-ring: #3a78e0;
      --m-tab: #f1f1f1;
      --m-tabline: rgba(0, 0, 0, .06);
      --m-pill: #e2e3e8;
      --m-tab-on: #1f4b92;
      --m-tab-off: #505865;
      --m-promo-top: 17.1rem;
      --m-bal-top: 30.13rem;
      --m-docs-top: 41rem;
      --m-docs-h: 15.25rem;
      --m-svc-top: 56.88rem;
      --m-svc-h: 15.9rem;
      --m-note-top: 75.83rem;
    }
  }

  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

  /*
    Весь макет свёрстан в rem от экрана шириной 360 (1rem = 10 единиц макета).
    Размер rem считается от ширины и высоты окна, поэтому экран целиком
    пропорционально сжимается и растягивается на любом устройстве.
  */
  html {
    height: 100%;
    font-size: min(100vw / 36, 100vh / 60, 13.34px);
    font-size: min(100vw / 36, 100dvh / 60, 13.34px);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Страница сама не листается и не «пружинит» в Safari; скролл только внутри .screen, если контент не влез */
  html, body { overflow: hidden; overscroll-behavior: none; }
  /* Главная (без #адреса) листается самой страницей: так Chrome прячет адресную строку, и шапка поднимается к верху экрана, как на скринах.
     Открытые экраны остаются как были; браузеры без :has() скроллят главную внутри блока. */
  @supports selector(:has(*)) {
    html:not(:has(:target)) { overflow-y: auto; scrollbar-width: none; }
    html:not(:has(:target))::-webkit-scrollbar { display: none; }
    html:not(:has(:target)) body { overflow: visible; }
    html:not(:has(:target)) .main-screen { height: auto; overflow: visible; }
  }

  body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Roboto, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 1.4rem;
  }

  .screen {
    width: 36rem;
    height: 100%;
    margin: 0 auto;
    padding-bottom: calc(9.5rem + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: none;
    scrollbar-width: none;
  }
  .screen::-webkit-scrollbar { display: none; }

  /* ---------- Верхняя панель ---------- */
  .topbar {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: calc(.4rem + env(safe-area-inset-top)) .1rem .4rem .4rem;
  }
  .topbar h1 {
    flex: 1;
    margin: 0;
    font-size: 1.9rem;
    font-weight: 500;
    letter-spacing: .02rem;
  }
  .icon-btn {
    width: 4.4rem;
    height: 4.4rem;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--icon);
    cursor: pointer;
  }
  .icon-btn:active { background: var(--icon-active); }
  /* Серый кружок у «поделиться» — только пока открыта шторка (в тёмной теме его нет) */
  .icon-btn--round.is-active { background: var(--round-btn); }
  .icon-btn svg { width: 2.2rem; height: 2.2rem; }

  /* ---------- Карточка ---------- */
  .card {
    position: relative;
    margin: 1.9rem .7rem 0;
    border-radius: .9rem;
    overflow: hidden;
    background: var(--card);
    color: var(--value);
  }
  .card-head {
    display: grid;
    place-items: center;
    height: 3.7rem;
    background: var(--card-head);
    color: #fff;
    font-family: "PT Serif", Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .03rem;
    text-transform: uppercase;
  }
  .card-body {
    position: relative;
    display: grid;
    grid-template-columns: 10.2rem 1fr;
    align-items: start;
    gap: 0 1.3rem;
    padding: 1.9rem .7rem 2rem 1.9rem;
  }

  .photo {
    position: relative;
    z-index: 1;
    height: 13.8rem;
    border-radius: 1rem;
    background: var(--photo-bg) center / cover no-repeat;
    overflow: hidden;
  }
  /* Силуэт-заглушка выбирается по полу персонажа (data-sex), пока у него нет своего фото */
  .photo .ph { display: none; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
  .photo[data-sex="m"] .ph-m,
  .photo[data-sex="f"] .ph-f { display: block; }
  .photo.has-img .ph { display: none; }

  .crest {
    position: absolute;
    /* Как в оригинале: привязан к низу карточки. Карточка по высоте равна контенту,
       поэтому при коротком тексте герб поднимается и частично уходит под фото. */
    left: 0;
    bottom: .5rem;
    width: 10.2rem;
    aspect-ratio: 349 / 558;
    /* Картинка герба служит маской, цвет берётся из темы (--crest) */
    background: var(--crest);
    -webkit-mask: url("/static/img/b74257534a50d976.png") center / 100% 100% no-repeat;
    mask: url("/static/img/b74257534a50d976.png") center / 100% 100% no-repeat;
    pointer-events: none;
    user-select: none;
  }

  .fields {
    position: relative;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
  }

  .number-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 2.6rem;
  }
  .number {
    color: var(--number);
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: .06rem;
    white-space: nowrap;
  }
  .copy-btn {
    width: 2.6rem;
    height: 2.6rem;
    padding: .45rem;
    border: 0;
    border-radius: .6rem;
    background: none;
    color: var(--number);
    cursor: pointer;
  }
  .copy-btn svg { display: block; width: 100%; height: 100%; }
  .copy-btn:active { background: rgba(138, 32, 41, .12); }

  dl { margin: 0; }
  .fields dl { width: 100%; }

  .row {
    display: grid;
    grid-template-columns: 9.6rem 1fr;
  }

  .field { margin-top: 1.23rem; min-width: 0; }
  .field dt {
    font-size: 1.12rem;
    line-height: 1.15rem;
    color: var(--label);
    letter-spacing: .025rem;
  }
  .field dd {
    margin: 0;
    padding-top: .1rem;
    font-size: 1.12rem;
    font-weight: 500;
    line-height: 1.52rem;
    letter-spacing: .035rem;
    text-transform: uppercase;
    overflow-wrap: anywhere;
  }
  /* Если подпись соседнего поля заняла две строки, значение опускается на полстроки — как в оригинале */
  .row .field { display: flex; flex-direction: column; }
  .row .field dd { margin: auto 0; }

  .details-link {
    margin-top: auto;
    padding: 1.25rem 0 0;
    border: 0;
    background: none;
    color: var(--link);
    text-decoration: none;
    font: inherit;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: .02rem;
    line-height: 1.5rem;
    cursor: pointer;
  }

  /* ---------- Нижняя кнопка ---------- */
  .bottom {
    position: fixed;
    left: 50%;
    bottom: 0;
    width: 36rem;
    padding: 1.2rem .7rem calc(1.6rem + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, var(--bg) 30%);
    transform: translateX(-50%);
  }
  .primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    width: 100%;
    height: 5.6rem;
    border: 0;
    border-radius: 1rem;
    background: var(--btn);
    color: #fff;
    text-decoration: none;
    font: inherit;
    font-size: 1.6rem;
    font-weight: 400;
    cursor: pointer;
  }
  .primary-btn:active { background: var(--btn-active); }
  .primary-btn svg { width: 2.2rem; height: 2.2rem; }

  /* ---------- Шторка / модалка ---------- */
  .overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
  }
  .overlay.open { opacity: 1; visibility: visible; }
  .sheet {
    width: 36rem;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1rem 2rem calc(2.4rem + env(safe-area-inset-bottom));
    border-radius: 1.8rem 1.8rem 0 0;
    background: var(--sheet);
    transform: translateY(100%);
    transition: transform .25s ease;
  }
  .overlay.open .sheet { transform: none; }
  .sheet::before {
    content: "";
    display: block;
    width: 4rem;
    height: .4rem;
    margin: 0 auto 1.4rem;
    border-radius: .2rem;
    background: var(--sheet-handle);
  }

  /* ---------- Экран «Установите приложение» ---------- */
  .install {
    position: fixed;
    inset: 0;
    z-index: 6;
    display: none;
    background: var(--bg);
    text-align: center;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .install:target { display: block; }
  .install .topbar { width: 36rem; margin: 0 auto; }
  .install .topbar a.icon-btn { text-decoration: none; }
  .install-logo {
    width: 13.6rem;
    height: 13.6rem;
    margin: 5.9rem auto 0;
    border-radius: 2.8rem;
    overflow: hidden;
  }
  .install-logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .install-title {
    margin: 5.1rem 2rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 2.2rem;
    color: var(--text);
  }
  .install-text {
    margin: 1.15rem 2rem 0;
    font-size: 1.35rem;
    line-height: 1.9rem;
    color: var(--install-sub);
  }
  .install .primary-btn { height: 5.9rem; }

  /* ---------- Экран «Детали документа» ---------- */
  /* Открывается ссылкой на #details и показывается через :target — работает и там, где JS выключен */
  .details {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: none;
    background: var(--d-bg);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .details::-webkit-scrollbar { display: none; }
  .details:target { display: block; }
  .details-inner {
    width: 36rem;
    margin: 0 auto;
    padding-bottom: calc(2.4rem + env(safe-area-inset-bottom));
  }
  .details-topbar {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--d-bg);
  }
  .details-topbar a.icon-btn { text-decoration: none; }

  .d-card {
    display: block;
    width: calc(100% - 1.4rem);
    margin: .8rem .7rem 0;
    border-radius: 1rem;
    background: var(--d-card);
    box-shadow: var(--d-card-shadow);
    color: var(--d-value);
  }

  .d-fields { margin-top: 1.9rem; padding: 2rem 1.9rem 1.64rem; }
  .d-field + .d-field { margin-top: 2.2rem; }
  .d-field dt {
    font-size: 1.3rem;
    line-height: 1.6rem;
    color: var(--d-label);
    letter-spacing: .02rem;
  }
  .d-field dd {
    margin: .7rem 0 0;
    font-size: 1.3rem;
    line-height: 2rem;
    letter-spacing: .02rem;
    overflow-wrap: anywhere;
  }

  .d-files { padding: 2.1rem 1.9rem 1.9rem; }
  .d-files h2 { margin: 0; font-size: 1.5rem; line-height: 2rem; font-weight: 700; }
  .d-file-list { margin: 1.2rem 0 0; padding: 0; list-style: none; }
  .d-file-list li {
    padding: .8rem 0;
    border-bottom: 1px solid var(--d-line);
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .d-add {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    height: 5.76rem;
    margin-top: 1.9rem;
    border: 1px dashed var(--d-dash);
    border-radius: 1rem;
    background: none;
    color: var(--d-link);
    font: inherit;
    font-size: 1.55rem;
    cursor: pointer;
  }
  .d-add:active { background: rgba(60, 132, 250, .08); }
  .d-add svg { width: 1.9rem; height: 1.9rem; }

  .d-share {
    display: block;
    width: calc(100% - 1.4rem);
    height: 5.5rem;
    margin: 2.3rem .7rem 0;
    border: 0;
    border-radius: 1rem;
    background: var(--btn);
    color: #fff;
    font: inherit;
    font-size: 1.55rem;
    cursor: pointer;
  }
  .d-share:active { background: var(--btn-active); }

  .d-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 6rem;
    margin-top: 3.3rem;
    padding: 0 1.5rem 0 2.1rem;
    border: 0;
    font: inherit;
    font-size: 1.65rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }
  .d-row:active { background: var(--d-active); }
  .d-row svg { width: 2rem; height: 2rem; color: var(--d-chevron); }

  .d-heading {
    margin: 3.2rem 2.6rem 0;
    font-size: 1.85rem;
    line-height: 2.4rem;
    font-weight: 700;
    color: var(--d-value);
  }
  .d-faq { margin-top: 1.5rem; padding: 1.9rem 1.9rem 2.1rem; background: var(--d-faq); box-shadow: none; }

  /* ---------- Статьи «Популярные вопросы» ---------- */
  .article {
    position: fixed;
    inset: 0;
    z-index: 7;
    display: none;
    background: var(--a-bg);
    color: var(--a-text);
    font-family: Lato, Roboto, -apple-system, "Segoe UI", Arial, sans-serif;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .article::-webkit-scrollbar { display: none; }
  .article:target { display: block; }
  .a-inner { width: 36rem; margin: 0 auto; padding-bottom: calc(1.2rem + env(safe-area-inset-bottom)); }
  .a-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: calc(5.4rem + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 2rem 0 0;
    background: var(--a-bg);
  }
  .a-close { padding: 1rem 0; color: var(--a-close); font-size: 1.4rem; font-weight: 700; text-decoration: none; }
  .a-title { margin: .7rem 2.1rem 0; font-size: 2.55rem; line-height: 2.8rem; font-weight: 900; color: var(--a-title); }

  .a-box {
    margin: 2.3rem 2.1rem 0;
    padding: .82rem .92rem 1rem;
    background: var(--a-box);
    font-size: 1.45rem;
    line-height: 1.76rem;
  }
  .a-box p { margin: 1.6rem 0 0; }
  .a-box > :first-child, .a-box li > :first-child { margin-top: 0; }
  .a-box .a-gap-lg { margin-top: 2.4rem; }
  .a-box h3 { margin: 2.5rem 0 0; font-size: 1.75rem; line-height: 2.2rem; font-weight: 700; color: var(--a-h3); }
  .a-box h3 + p { margin-top: 1.4rem; }
  .a-blue { color: var(--a-link); }

  .a-list { margin: .74rem 0 0; padding: 0; list-style: none; }
  .a-box h3 + .a-list { margin-top: .6rem; }
  .a-list li { position: relative; padding-left: 1.88rem; }
  .a-list li + li { margin-top: 1.2rem; }
  .a-list li::before { content: ""; position: absolute; left: .2rem; background: var(--a-bullet); }
  .a-list--dash li::before { top: .77rem; width: .7rem; height: .22rem; }
  .a-list--dot li::before { top: .53rem; width: .7rem; height: .7rem; border-radius: 50%; }

  .a-rate { display: flex; gap: .85rem; margin: 3.1rem 0 0 2.9rem; }
  .a-rate button {
    display: grid;
    place-items: center;
    width: 14.2rem;
    height: 3.9rem;
    border: 2px solid var(--a-rate-border);
    border-radius: 1rem;
    background: none;
    color: var(--a-rate-icon);
    cursor: pointer;
  }
  .a-rate button.is-selected { border-color: var(--a-close); color: var(--a-close); }
  .a-rate svg { width: 2rem; height: 2rem; }

  .a-heading { margin: 6.5rem 2.9rem 0; font-size: 2rem; line-height: 2.6rem; font-weight: 900; color: var(--a-title); }
  .a-card {
    display: flex;
    align-items: center;
    height: 6rem;
    margin: 1.45rem .8rem 0;
    padding: 0 2rem;
    border-radius: 1.3rem;
    background: var(--a-card);
    color: var(--a-card-link);
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
  }
  .a-banner {
    position: relative;
    display: block;
    width: calc(100% - 1.6rem);
    height: 9.2rem;
    margin: 3.2rem .8rem 0;
    padding: 2.2rem 2rem 0;
    border: 0;
    border-radius: 1.3rem;
    background: var(--a-banner);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .a-banner b { display: block; font-size: 1.75rem; line-height: 2rem; font-weight: 700; }
  .a-banner span { display: block; margin-top: .9rem; font-size: 1.45rem; line-height: 1.8rem; }
  /* Робот справа на баннере (PNG с прозрачным фоном вшит ниже) */
  .a-robot {
    position: absolute;
    right: 3.6rem;
    bottom: .4rem;
    width: 5.25rem;
    height: 8rem;
    background: url("/static/img/dfac5cb00ed727cf.png") center bottom / contain no-repeat;
  }
  .a-contacts {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    width: calc(100% - 1.6rem);
    height: 6.2rem;
    margin: .8rem .8rem 0;
    padding: 0 1.6rem 0 2rem;
    border: 0;
    border-radius: 1.3rem;
    background: var(--a-contact);
    box-shadow: var(--a-contact-shadow);
    color: var(--a-contact-text);
    font: inherit;
    font-size: 1.75rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }
  .a-contacts span { flex: 1; }
  .a-contacts .a-phone { width: 2rem; height: 2rem; color: var(--a-phone); }
  .a-contacts .a-chev { width: 2rem; height: 2rem; color: var(--a-chevron); }

  /* ---------- Диалог «Выберите способ добавления» ---------- */
  .overlay--center { align-items: center; background: var(--dim); }
  .dialog {
    width: 31.2rem;
    border-radius: .3rem;
    background: var(--dlg);
    overflow: hidden;
    transform: scale(.95);
    transition: transform .15s;
  }
  .overlay.open .dialog { transform: none; }
  .dialog-head {
    display: flex;
    align-items: center;
    height: 4.6rem;
    padding: 0 1.55rem;
    color: var(--dlg-head);
    font-size: 1.15rem;
    letter-spacing: .03rem;
  }
  .dialog-item {
    display: block;
    width: 100%;
    height: 4.35rem;
    padding: 0 1.55rem;
    border: 0;
    border-top: 1px solid var(--dlg-line);
    background: none;
    color: var(--dlg-text);
    font: inherit;
    font-size: 1.55rem;
    text-align: left;
    cursor: pointer;
  }
  .dialog-item--last { height: 5.05rem; padding-bottom: .7rem; }
  .dialog-item:active { background: var(--icon-active); }

  /* ---------- Выпадающее меню (три точки на экране деталей) ---------- */
  .popup {
    position: fixed;
    top: calc(4.8rem + env(safe-area-inset-top));
    right: max(1rem, calc(50% - 17rem)); /* прижато к правому краю колонки 36rem */
    z-index: 9;
    width: 11.2rem;
    padding: 0;
    border-radius: .9rem;
    background: var(--popup);
    box-shadow: var(--popup-shadow);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(.9);
    transform-origin: top right;
    transition: opacity .15s, transform .15s, visibility .15s;
  }
  .popup.open { opacity: 1; visibility: visible; transform: none; }
  .popup-item {
    display: block;
    width: 100%;
    height: 4rem;
    padding: 0 1.5rem;
    border: 0;
    background: none;
    color: var(--popup-text);
    font: inherit;
    font-size: 1.55rem;
    text-align: left;
    cursor: pointer;
  }
  .popup-item:active { background: var(--icon-active); }
  .d-link {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: var(--d-link);
    font: inherit;
    font-size: 1.27rem;
    font-weight: 500;
    line-height: 1.8rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }
  .d-link + .d-link { margin-top: 1.96rem; }

  /* ---------- Шторка «Поделиться» ---------- */
  .share-sheet { padding: .76rem .7rem calc(1.6rem + env(safe-area-inset-bottom)); max-height: 94vh; }
  .share-sheet::before { width: 5.2rem; margin-bottom: 1.34rem; }
  .share-frame {
    margin: 0 1.6rem;
    padding: .35rem .35rem 0;
    border: 1px solid var(--frame-border);
    border-radius: 1.3rem;
    background: #fff;
  }
  /* Копия карточки с главной, уменьшенная до ширины рамки (34.6rem → 30.7rem) */
  .share-preview .card { margin: 0; zoom: .887; }
  .share-brand {
    display: grid;
    place-items: center;
    height: 3.95rem;
    color: #2a2a2e;
    font-size: 2rem;
    font-weight: 700;
  }
  .share-btn {
    display: block;
    width: 100%;
    height: 5.5rem;
    margin-top: 3.1rem;
    border: 0;
    border-radius: 1rem;
    background: var(--btn);
    color: #fff;
    font: inherit;
    font-size: 1.6rem;
    cursor: pointer;
  }
  .share-btn:active { background: var(--btn-active); }
  .share-btn--outline {
    margin-top: 1.2rem;
    border: 2px solid var(--btn-outline);
    background: transparent;
    color: var(--btn-outline-text);
  }
  .share-btn--outline:active { background: var(--icon-active); }

  /* ---------- Тост ---------- */
  .toast {
    position: fixed;
    left: 50%;
    bottom: calc(10rem + env(safe-area-inset-bottom));
    z-index: 20;
    padding: 1rem 1.8rem;
    border-radius: 2rem;
    background: var(--toast);
    color: #fff;
    font-size: 1.4rem;
    white-space: nowrap;
    transform: translate(-50%, 1rem);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  /* ---------- Главная: копия экрана приложения по замерам со скринов (1 rem = 10 px макета 360) ---------- */
  .main-screen {
    width: 36rem;
    height: 100%;
    margin: 0 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    scrollbar-width: none;
  }
  .main-screen::-webkit-scrollbar { display: none; }
  .m-stage {
    position: relative;
    height: 92rem;
    margin-top: -3.8rem;
    background: var(--m-bg);
    color: var(--m-title);
  }
  .m-abs { position: absolute; display: block; }
  /* Иконки снимаются отдельно для светлой и тёмной темы (на скринах они стоят в разных местах) */
  .th-l { display: none; }
  .th-d { display: block; }
  @media (prefers-color-scheme: light) {
    .th-l { display: block; }
    .th-d { display: none; }
  }

  /* Шапка: липкая, сплошной цвет; на скролле контент уходит под неё */
  .m-head {
    position: sticky;
    top: -3.8rem;
    z-index: 3;
    height: 10.6rem;
    background: var(--m-head);
  }
  .ic-avatar.th-l { left: 1.469rem; top: 6.844rem; width: 2.469rem; height: 2.469rem; }
  .ic-avatar.th-d { left: 1.375rem; top: 6.781rem; width: 2.344rem; height: 2.344rem; }
  .ic-search.th-l { left: 20.969rem; top: 7.063rem; width: 2.25rem; height: 2.25rem; }
  .ic-search.th-d { left: 21.906rem; top: 6.969rem; width: 2.125rem; height: 2.125rem; }
  .ic-bell.th-l { left: 24.969rem; top: 6.844rem; width: 2.469rem; height: 2.469rem; }
  .ic-bell.th-d { left: 25.656rem; top: 6.781rem; width: 2.25rem; height: 2.281rem; }
  .m-name {
    display: flex;
    align-items: center;
    position: absolute;
    left: 4.6rem;
    top: 7.36rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font: inherit;
    font-size: 1.65rem;
    line-height: 1.65rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
  }
  .m-chev { flex: none; width: .62rem; height: .97rem; margin-left: .9rem; }
  /* Иконка сканера: скобки сняты с эталона (белые на любой теме), подпись поверх по центру */
  .m-qr {
    position: absolute;
    left: 29.53rem;
    top: 7.125rem;
    width: 4.97rem;
    height: 1.875rem;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font: inherit;
    cursor: pointer;
  }
  .m-qr img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
  .m-qr span {
    position: absolute;
    left: 0;
    right: 0;
    top: .06rem;
    line-height: 1.875rem;
    font-size: 1.3rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
  }
  /* Светлая тема: на эталоне скобки шире (справа вертикальная черта), подпись крупнее */
  @media (prefers-color-scheme: light) {
    .m-qr { left: 29rem; top: 7.03125rem; width: 5.46875rem; height: 2.1875rem; }
    .m-qr span { top: .1rem; line-height: 2.1875rem; font-size: 1.35rem; }
  }

  /* Чипы: ряд, который уходит за правый край */
  .m-chips {
    position: absolute;
    left: 0;
    top: 10.95rem;
    width: 36rem;
    height: 3rem;
    display: flex;
    gap: .85rem;
    padding-left: 1.6rem;
    box-sizing: border-box;
    overflow: hidden;
  }
  .m-chip {
    flex: none;
    height: 3rem;
    padding: 0 1.2rem;
    border: 0;
    border-radius: 1.5rem;
    background: var(--m-chip);
    color: #fff;
    font: inherit;
    font-size: 1.27rem;
    line-height: 3rem;
    white-space: nowrap;
    cursor: pointer;
  }

  /* Промо-плитки: 98x100, кольцо снаружи с зазором */
  .m-promos {
    position: absolute;
    left: 0;
    top: calc(var(--m-promo-top) - 4.1rem);
    width: 36rem;
    height: 17.8rem;
    display: flex;
    gap: 1.2rem;
    padding: 4.1rem 0 0 1.6rem;
    box-sizing: border-box;
    overflow: hidden;
  }
  .m-promo {
    flex: none;
    position: relative;
    width: 9.8rem;
    height: 10rem;
    padding: 0;
    border: 0;
    border-radius: 1.5rem;
    background: none;
    cursor: pointer;
  }
  .m-promo img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 1.5rem;
    object-fit: cover;
    outline: .12rem solid var(--m-ring);
    outline-offset: .25rem;
  }


  /* Блок «Нет начислений» */
  .m-balance {
    position: absolute;
    left: 1.6rem;
    top: var(--m-bal-top);
    width: 32.8rem;
    height: 7.47rem;
    box-sizing: border-box;
    border-radius: 1.6rem;
    border: .1rem solid var(--m-balance-line);
    background: var(--m-balance);
  }
  .m-balance b {
    position: absolute;
    left: 1.88rem;
    top: 1.9rem;
    font-size: 1.68rem; letter-spacing: .02em;
    line-height: 1.68rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
  }
  .m-balance span {
    position: absolute;
    left: 1.89rem;
    top: 4.55rem;
    font-size: 1.35rem;
    line-height: 1.35rem;
    color: rgba(255, 255, 255, .88);
    white-space: nowrap;
  }

  /* Карточки «Документы» и «Сервисы» */
  .m-card {
    position: absolute;
    left: .8rem;
    width: 34.4rem;
    border-radius: 1.2rem;
    background: var(--m-card);
  }
  .m-card h2 {
    position: absolute;
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.65rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--m-title);
    white-space: nowrap;
  }
  .m-docs { top: var(--m-docs-top); height: var(--m-docs-h); }
  .m-docs h2 { left: 2.01rem; top: 2.21rem; }
  .m-svc-card { top: var(--m-svc-top); height: var(--m-svc-h); }
  .m-svc-card h2 { left: 2.04rem; top: 2.71rem; }
  .m-row { position: absolute; display: grid; }
  .m-row--docs { left: .4165rem; top: 5.69rem; grid-template-columns: repeat(4, 8.407rem); }
  .m-row--svc { left: 1rem; top: 6.245rem; grid-template-columns: repeat(4, 8.097rem); }
  .m-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--m-label);
    font: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
  }
  .m-tile { display: block; width: 5.66rem; height: 5.66rem; border-radius: 1.4rem; }
  .m-lbl {
    margin-top: .93rem;
    font-size: 1rem;
    line-height: 1rem;
    font-weight: 600;
    letter-spacing: .05em;
    white-space: nowrap;
  }
  .m-row--svc .m-lbl { margin-top: .935rem; font-size: 1.1rem; line-height: 1.1rem; letter-spacing: 0; }
  .m-svc {
    position: relative;
    display: grid;
    place-items: center;
    width: 5.56rem;
    height: 5.56rem;
    border: .1rem solid var(--m-line);
    border-radius: 1.4rem;
    background: var(--m-svc-bg);
  }
  /* Иконки с новых скринов: картинка-холст на всю плитку, иконка стоит по её центру */
  .m-svc img { position: absolute; left: -.1rem; top: -.1rem; width: 5.56rem; height: 5.56rem; }
  .m-svc .svc-any { position: static; width: 3.6rem; height: 3.6rem; }

  /* Заметка внизу */
  .m-note {
    position: absolute;
    left: .8rem;
    top: var(--m-note-top);
    width: 34.4rem;
    height: 6.6rem;
    box-sizing: border-box;
    border-radius: 1.2rem;
    border: .1rem solid var(--m-note-line);
  }
  .m-note p {
    position: absolute;
    left: 1.94rem;
    top: 1.21rem;
    margin: 0;
    font-size: 1.35rem;
    line-height: 2rem;
    color: var(--m-note);
    white-space: nowrap;
  }

  /* Нижняя панель (фиксирована внизу, 78 px) */
  .m-tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 3;
    width: 36rem;
    height: 7.8rem;
    box-sizing: border-box;
    transform: translateX(-50%);
    background: var(--m-tab);
    border-top: .1rem solid var(--m-tabline);
  }
  .m-tab-pill {
    position: absolute;
    left: 1.4rem;
    top: 1.15rem;
    width: 4.3rem;
    height: 2.95rem;
    border-radius: 1.5rem;
    background: var(--m-pill);
  }
  .ic-home.th-l { left: 2.469rem; top: 1.325rem; width: 2.313rem; height: 2.375rem; }
  .ic-home.th-d { left: 2.5rem; top: 1.669rem; width: 2.25rem; height: 2.063rem; }
  .ic-grid.th-l { left: 9.688rem; top: 1.544rem; width: 2.156rem; height: 2.125rem; }
  .ic-grid.th-d { left: 9.719rem; top: 1.856rem; width: 2.031rem; height: 2.063rem; }
  .ic-wallet.th-l { left: 24.125rem; top: 1.606rem; width: 2.156rem; height: 1.969rem; }
  .ic-wallet.th-d { left: 24.188rem; top: 1.95rem; width: 2.031rem; height: 1.906rem; }
  .ic-doc.th-l { left: 31.531rem; top: 1.544rem; width: 1.781rem; height: 2.125rem; }
  .ic-doc.th-d { left: 31.563rem; top: 1.856rem; width: 1.688rem; height: 2.094rem; }
  .m-robot { position: absolute; left: 16rem; top: 1.988rem; width: 4.031rem; height: 4.344rem; }
  .m-tab-lbl {
    position: absolute;
    top: 4.8rem;
    width: 7.2rem;
    font-size: 1.25rem;
    line-height: 1.25rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    color: var(--m-tab-off);
  }
  .m-tab-lbl.is-on { color: var(--m-tab-on); }
  .tl-1 { left: 0; }
  .tl-2 { left: 7.14rem; }
  .tl-3 { left: 21.55rem; }
  .tl-4 { left: 28.77rem; }
  .m-hit {
    position: absolute;
    top: 0;
    width: 7.2rem;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }
  .hit-1 { left: 0; }
  .hit-2 { left: 7.14rem; }
  .hit-3 { left: 14.4rem; }
  .hit-4 { left: 21.55rem; }
  .hit-5 { left: 28.77rem; }

  /* ---------- Паспорт: отдельный экран по #passport, поверх главной ---------- */
  .passport { position: fixed; inset: 0; z-index: 4; display: none; background: var(--bg); }
  .passport:target { display: block; }

  /* Логотип в шторке «Поделиться» */
  .share-brand img { display: block; width: auto; height: 3.4rem; }

/* ---------- Экран-заглушка: нет ссылки, документ недоступен, нет связи ---------- */
.state {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 0 3.2rem;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}
.state[hidden] { display: none; }
.state p { margin: 0; max-width: 30rem; font-size: 1.6rem; line-height: 2.2rem; color: var(--install-sub); }
