/*
 * Кабинет агента Vulpes — agent.vulpes.pro
 *
 * Фирменный стиль общий с ЛК HelpDesk (sup.vulpes.pro): оранжевый акцент, Montserrat и Roboto,
 * светлая и тёмная тема. Подпись — «лисий след»: путь клиента от заявки до выплаты линией
 * в градиенте «угли → лисий оранжевый». Тот же язык — в шагах входа, лестнице уровней и на 404.
 *
 * Классы — с префиксом ac-, хуки скриптов — data-ac-*. Вёрстка от телефона (от 360px),
 * шире — через min-width. Появление и анимации — только при prefers-reduced-motion: no-preference,
 * начальные «скрытые» состояния тоже только там: без анимаций всё видно сразу.
 */

/* ---------- Шрифты: с этого же сервера, без внешних CDN ---------- */
@font-face { font-family: "Vulpes Display"; src: url("fonts/montserrat-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Vulpes Display"; src: url("fonts/montserrat-bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vulpes Text"; src: url("fonts/roboto-regular-webfont.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vulpes Text"; src: url("fonts/roboto-medium-webfont.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vulpes Mono"; src: url("fonts/robotomono-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* ---------- Токены: день ---------- */
:root {
    color-scheme: light;
    --font-display: "Vulpes Display", "Montserrat", "Segoe UI", Arial, sans-serif;
    --font-text: "Vulpes Text", "Roboto", "Segoe UI", Arial, sans-serif;
    --font-mono: "Vulpes Mono", "Roboto Mono", Consolas, monospace;

    --paper: #f3f4f6;
    --card: #ffffff;
    --field: #f8f9fb;
    --bar: rgba(255, 255, 255, .86);
    --ink: #14161a;
    --ink-2: #555b66;
    --ink-3: #686e79;        /* темнее, чем в ЛК HelpDesk: мелкий текст держит контраст 4.5:1 */
    --rule: #e3e6eb;
    --rule-strong: #cfd4dc;

    --fox: #f7931e;
    --fox-hover: #e8830d;
    --fox-text: #b4470c;
    --fox-soft: #fdeedd;
    --fox-ring: rgba(247, 147, 30, .24);
    --on-fox: #1a1208;
    --fox-gradient: linear-gradient(90deg, #e2572a 0%, #f7931e 100%);
    /* След: четыре точки градиента от углей к лисьему оранжевому */
    --trail-0: #e2572a;
    --trail-1: #e96b26;
    --trail-2: #f07f22;
    --trail-3: #f7931e;
    /* Тёплое свечение за следом на странице входа */
    --glow-1: rgba(247, 147, 30, .17);
    --glow-2: rgba(226, 87, 42, .08);
    --focus: #b4470c;        /* рамка фокуса: на светлом фоне ярко-оранжевая не видна */

    --ok-fg: #13703a;
    --ok-bg: #e2f4e9;
    --err-fg: #c0262d;
    --err-bg: #fde9e9;

    --shadow: 0 1px 2px rgba(16, 20, 26, .04), 0 10px 30px -18px rgba(16, 20, 26, .18);
    --shadow-lift: 0 1px 2px rgba(16, 20, 26, .05), 0 22px 44px -24px rgba(16, 20, 26, .24), 0 44px 90px -56px rgba(226, 87, 42, .32);
    --radius: 16px;
    --radius-lg: 22px;
    --radius-sm: 12px;

    /* Поля по бокам; на телефоне с вырезом — не меньше безопасной зоны */
    --gutter: 16px;
    --inset-l: max(var(--gutter), env(safe-area-inset-left, 0px));
    --inset-r: max(var(--gutter), env(safe-area-inset-right, 0px));

    --show-moon: inline-block;
    --show-sun: none;
}

/* ---------- Токены: ночь (как vulpes.uz) ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --paper: #111112;
        --card: #1b1b1d;
        --field: #232326;
        --bar: rgba(17, 17, 18, .82);
        --ink: #f2f2f3;
        --ink-2: #a8aab1;
        --ink-3: #8a8c94;
        --rule: #2b2b2f;
        --rule-strong: #3a3a40;
        --fox: #fd9c12;
        --fox-hover: #ffad3a;
        --fox-text: #ffb24d;
        --fox-soft: #2f210f;
        --fox-ring: rgba(253, 156, 18, .26);
        --fox-gradient: linear-gradient(90deg, #f0612b 0%, #fd9c12 100%);
        --trail-0: #f0612b;
        --trail-1: #f47423;
        --trail-2: #f9891a;
        --trail-3: #fd9c12;
        --glow-1: rgba(240, 97, 43, .21);
        --glow-2: rgba(253, 156, 18, .07);
        --focus: #fd9c12;
        --ok-fg: #6fdb9e;
        --ok-bg: #13301f;
        --err-fg: #ff8e92;
        --err-bg: #3a1718;
        --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 14px 34px -20px rgba(0, 0, 0, .7);
        --shadow-lift: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 28px 60px -30px rgba(0, 0, 0, .85), 0 44px 100px -56px rgba(240, 97, 43, .42);
        --show-moon: none;
        --show-sun: inline-block;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #111112;
    --card: #1b1b1d;
    --field: #232326;
    --bar: rgba(17, 17, 18, .82);
    --ink: #f2f2f3;
    --ink-2: #a8aab1;
    --ink-3: #8a8c94;
    --rule: #2b2b2f;
    --rule-strong: #3a3a40;
    --fox: #fd9c12;
    --fox-hover: #ffad3a;
    --fox-text: #ffb24d;
    --fox-soft: #2f210f;
    --fox-ring: rgba(253, 156, 18, .26);
    --fox-gradient: linear-gradient(90deg, #f0612b 0%, #fd9c12 100%);
    --trail-0: #f0612b;
    --trail-1: #f47423;
    --trail-2: #f9891a;
    --trail-3: #fd9c12;
    --glow-1: rgba(240, 97, 43, .21);
    --glow-2: rgba(253, 156, 18, .07);
    --focus: #fd9c12;
    --ok-fg: #6fdb9e;
    --ok-bg: #13301f;
    --err-fg: #ff8e92;
    --err-bg: #3a1718;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 14px 34px -20px rgba(0, 0, 0, .7);
    --shadow-lift: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 28px 60px -30px rgba(0, 0, 0, .85), 0 44px 100px -56px rgba(240, 97, 43, .42);
    --show-moon: none;
    --show-sun: inline-block;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.ac-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font: 400 15px/1.55 var(--font-text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--fox-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a:focus-visible { border-radius: 4px; }
h1, h2, h3, p, ul, ol { margin: 0; }
p { text-wrap: pretty; }
b { font-weight: 500; color: var(--ink); } /* у Roboto есть только 400 и 500 — без «дорисованного» жирного */

.ac-muted { color: var(--ink-2); }
.ac-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.ac-icon { width: 20px; height: 20px; flex: none; }
.ac-eyebrow {
    font: 600 12px/1.3 var(--font-display);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fox-text);
}
.ac-lead { font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 44ch; }
.ac-skip {
    position: absolute;
    left: 12px;
    top: -100px;
    z-index: 20;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--card);
    font: 600 14px/1.2 var(--font-display);
    text-decoration: none;
}
.ac-skip:focus { top: 12px; color: var(--card); }

/* ---------- Шапка ---------- */
.ac-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bar);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--rule);
}
/* У входа шапка прозрачная — лежит на тёплом фоне страницы */
.ac-bar--bare {
    position: relative;
    background: transparent;
    border-bottom-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.ac-bar__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: max(8px, env(safe-area-inset-top, 0px)) var(--inset-r) 8px var(--inset-l);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.ac-logo { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
.ac-logo:hover { color: var(--ink); }
.ac-logo__mark { flex: none; width: 32px; height: 32px; object-fit: contain; }
.ac-logo__word { font: 700 20px/1 var(--font-display); letter-spacing: -.01em; }
.ac-logo__sub {
    display: none;
    font: 500 14px/1 var(--font-text);
    color: var(--ink-2);
    padding-left: 12px;
    border-left: 1px solid var(--rule-strong);
    white-space: nowrap;
}
.ac-bar--bare .ac-logo__sub { display: inline; }
.ac-bar__actions { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ac-bar__logout { margin: 0; }

.ac-icon-btn {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.ac-icon-btn:hover { background: var(--field); border-color: var(--rule); color: var(--ink); }
.ac-icon-btn[disabled] { opacity: .6; cursor: progress; }
.ac-theme-toggle .ac-icon--moon { display: var(--show-moon); }
.ac-theme-toggle .ac-icon--sun { display: var(--show-sun); }
/* Без JS переключатель ничего не умеет — не показываем */
html:not(.ac-js) .ac-theme-toggle { display: none; }

.ac-user { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: 4px; }
.ac-user__name {
    display: none;
    max-width: 240px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-avatar {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fox-gradient);
    color: var(--on-fox);
    font: 700 13px/1 var(--font-display);
    letter-spacing: .02em;
}
.ac-avatar--quiet { width: 40px; height: 40px; background: var(--field); border: 1px solid var(--rule); color: var(--ink-2); }
/* На узком телефоне в шапке места только на уровень: кружок прячем */
.ac-bar .ac-avatar { display: none; }

/* Уровень агента: Start — нейтральный, Business — оранжевый, Premium — фирменный градиент */
.ac-tier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--rule-strong);
    background: var(--field);
    color: var(--ink-2);
    font: 600 12px/1.3 var(--font-display);
    letter-spacing: .02em;
    white-space: nowrap;
}
.ac-tier::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ac-tier--business { border-color: transparent; background: var(--fox-soft); color: var(--fox-text); }
.ac-tier--premium { border-color: transparent; background: var(--fox-gradient); color: var(--on-fox); }

/* ---------- Каркас ---------- */
.ac-main {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px var(--inset-r) 48px var(--inset-l);
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.ac-main:focus { outline: none; }
.ac-footer {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px var(--inset-r) max(24px, env(safe-area-inset-bottom, 0px)) var(--inset-l);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    font-size: 13px;
    color: var(--ink-3);
}
.ac-footer a { color: var(--ink-3); }
.ac-footer a:hover { color: var(--ink); }

/* ---------- Уведомления ---------- */
.ac-toast, .ac-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.ac-toast .ac-icon, .ac-alert .ac-icon { margin-top: 1px; }
.ac-toast { background: var(--ok-bg); color: var(--ok-fg); }
.ac-alert { background: var(--err-bg); color: var(--err-fg); }
.ac-alert__list { display: grid; gap: 4px; min-width: 0; }

/* ---------- Кнопки ---------- */
.ac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid transparent;
    font: 600 15px/1.2 var(--font-display);
    letter-spacing: .01em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.ac-btn .ac-icon { transition: transform .2s ease-out; }
.ac-btn--primary {
    background: var(--fox);
    color: var(--on-fox);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 12px 24px -14px rgba(226, 87, 42, .85);
}
.ac-btn--primary:hover { background: var(--fox-hover); color: var(--on-fox); }
.ac-btn--primary:hover .ac-icon { transform: translateX(3px); }
.ac-btn--primary:active { transform: translateY(1px); }
.ac-btn--secondary { background: var(--card); color: var(--ink); border-color: var(--rule-strong); }
.ac-btn--secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.ac-btn--block { width: 100%; }
.ac-btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* Текстовые действия: «Отправить код ещё раз», «Изменить адрес» */
.ac-link-btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--fox-text);
    font: 600 14px/1.2 var(--font-display);
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.ac-link-btn:hover { background: var(--field); color: var(--ink); }
.ac-link-btn[disabled] { color: var(--ink-3); background: transparent; cursor: default; }
.ac-inline-form { margin: 0; }

/* ---------- Поля ---------- */
.ac-form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.ac-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ac-field__label { font: 600 13px/1.3 var(--font-display); letter-spacing: .01em; color: var(--ink); }
.ac-field__hint { font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.ac-input {
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--rule-strong);
    background: var(--field);
    color: var(--ink);
    font: 400 16px/1.4 var(--font-text); /* 16px: iOS не увеличивает страницу при фокусе */
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.ac-input::placeholder { color: var(--ink-3); opacity: 1; }
.ac-input:hover { border-color: var(--ink-3); }
.ac-input:focus {
    outline: none;
    border-color: var(--focus);
    background: var(--card);
    box-shadow: 0 0 0 4px var(--fox-ring);
}
.ac-input[aria-invalid="true"] { border-color: var(--err-fg); }
/* Код без скрипта: одно поле, разрядка сдвигает цифры влево — слева отступ больше на её ширину */
.ac-input--code {
    min-height: 58px;
    padding-left: calc(16px + .45em);
    font: 500 26px/1 var(--font-mono);
    letter-spacing: .45em;
    text-align: center;
}

/* ---------- Код по клеткам ---------- */
/* script.js добавляет is-ready: настоящее поле ложится прозрачным поверх клеток и принимает ввод,
   вставку и автозаполнение; клетки только показывают цифры */
.ac-otp { position: relative; }
.ac-otp__slots { display: none; }
.ac-otp.is-ready .ac-otp__slots { display: flex; gap: 14px; }
.ac-otp__group { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ac-otp__slot {
    display: grid;
    place-items: center;
    height: 58px;
    border-radius: 14px;
    border: 1px solid var(--rule-strong);
    background: var(--field);
    color: var(--ink);
    font: 500 26px/1 var(--font-mono);
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.ac-otp__slot.is-filled { background: var(--card); border-color: var(--ink-3); }
.ac-otp:focus-within .ac-otp__slot.is-active { background: var(--card); border-color: var(--focus); box-shadow: 0 0 0 4px var(--fox-ring); }
.ac-otp:focus-within .ac-otp__slot.is-active:empty::after {
    content: "";
    width: 2px;
    height: 26px;
    border-radius: 1px;
    background: var(--fox);
}
.ac-otp.is-invalid .ac-otp__slot { border-color: var(--err-fg); }
.ac-otp.is-ready .ac-otp__input {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: transparent;
    font-size: 16px;
    letter-spacing: 0;
    cursor: text;
}
.ac-otp.is-ready .ac-otp__input:focus { outline: none; box-shadow: none; background: transparent; }
.ac-otp.is-ready .ac-otp__input::selection { background: transparent; }

/* ---------- Вход ---------- */
.ac-body--login {
    background:
        radial-gradient(70vmax 55vmax at 10% 82%, var(--glow-1), transparent 62%),
        radial-gradient(45vmax 35vmax at 94% 4%, var(--glow-2), transparent 60%),
        var(--paper);
}
.ac-login {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 4px var(--inset-r) 40px var(--inset-l);
    display: grid;
    gap: 48px;
    align-content: start;
}
.ac-login:focus { outline: none; }

.ac-login__card {
    display: grid;
    gap: 20px;
    align-content: start;
    padding: 22px 20px 24px;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
}
.ac-login__head { display: grid; gap: 8px; }
.ac-login__title { font: 700 26px/1.15 var(--font-display); letter-spacing: -.025em; }
.ac-login__lead { color: var(--ink-2); overflow-wrap: anywhere; }
.ac-login__more { display: grid; gap: 6px; padding-top: 16px; border-top: 1px solid var(--rule); }
.ac-login__hint { font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.ac-login__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; margin: 0 -10px; }
.ac-login__alt { font-size: 14px; text-align: center; }

.ac-or { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); }
.ac-or::before, .ac-or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Шаги входа — два отрезка следа: пройденный залит, текущий залит наполовину, на конце точка */
.ac-steps__list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ac-steps__item { display: grid; gap: 8px; }
.ac-steps__bar { position: relative; height: 4px; border-radius: 4px; background: var(--rule); }
.ac-steps__bar::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-radius: inherit;
    background: var(--fox-gradient);
}
.ac-steps__item.is-done .ac-steps__bar::before { width: 100%; }
.ac-steps__item.is-current .ac-steps__bar::before { width: 58%; }
.ac-steps__item.is-current .ac-steps__bar::after {
    content: "";
    position: absolute;
    left: 58%;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--fox);
}
.ac-steps__label { font: 600 11px/1.2 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ac-steps__item.is-done .ac-steps__label { color: var(--ink-2); }
.ac-steps__item.is-current .ac-steps__label { color: var(--ink); }

/* Путь клиента: заголовок, пояснение и сам след */
.ac-story { display: grid; gap: 18px; align-content: start; }
.ac-display {
    display: grid;
    font: 700 36px/1.02 var(--font-display);
    letter-spacing: -.035em;
    text-wrap: balance;
}
.ac-display__from { color: var(--ink-2); }
.ac-display__to { color: var(--ink); }

.ac-trail { list-style: none; padding: 0; display: grid; margin-top: 8px; }
.ac-trail__stage {
    --c: var(--trail-3);
    position: relative;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 2px;
    padding-bottom: 22px;
}
.ac-trail__stage:nth-child(1) { --c: var(--trail-0); --d: .3s; }
.ac-trail__stage:nth-child(2) { --c: var(--trail-1); --d: .6s; }
.ac-trail__stage:nth-child(3) { --c: var(--trail-2); --d: .9s; }
.ac-trail__stage:nth-child(4) { --c: var(--trail-3); --d: 1.2s; }
.ac-trail__stage:last-child { padding-bottom: 0; }
.ac-trail__node {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    position: relative;
    z-index: 1;
    width: 11px;
    height: 11px;
    margin-top: 6.5px;
    border-radius: 50%;
    background: var(--c);
}
.ac-trail__stage--goal .ac-trail__node {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    background: var(--fox-gradient);
    box-shadow: 0 0 0 5px var(--fox-ring);
}
/* Отрезок — от центра своей точки до центра следующей; SVG растянут по высоте пункта */
.ac-trail__line { position: absolute; left: 0; top: 12px; bottom: -12px; width: 24px; }
.ac-trail__line svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ac-trail__line path { fill: none; stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ac-trail__title { grid-column: 2; font: 600 16px/24px var(--font-display); letter-spacing: -.005em; }
.ac-trail__text { grid-column: 2; font-size: 14px; line-height: 1.5; color: var(--ink-2); max-width: 46ch; }
.ac-trail__stage--goal .ac-trail__title { color: var(--fox-text); }
.ac-trail-stop-0 { stop-color: var(--trail-0); }
.ac-trail-stop-1 { stop-color: var(--trail-1); }
.ac-trail-stop-2 { stop-color: var(--trail-2); }
.ac-trail-stop-3 { stop-color: var(--trail-3); }
/* Градиенты следа: не display:none — иначе Firefox не рисует ссылки на них */
.ac-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Главная ---------- */
.ac-welcome { display: grid; gap: 16px; }
.ac-welcome__text { display: grid; gap: 10px; align-content: center; padding: 4px 0; }
.ac-h1 {
    font: 700 30px/1.08 var(--font-display);
    letter-spacing: -.03em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.ac-tier-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    gap: 18px;
    align-content: start;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
/* Тёплое пятно в углу — ярче на уровнях выше */
.ac-tier-card::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: -70px;
    top: -90px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--glow-1), transparent);
    opacity: .6;
    pointer-events: none;
}
.ac-tier-card--business::before { opacity: 1; }
.ac-tier-card--premium::before { opacity: 1; width: 320px; height: 320px; background: radial-gradient(closest-side, var(--fox-ring), transparent); }
.ac-tier-card__head { display: grid; gap: 6px; }
.ac-tier-card__name { font: 700 30px/1 var(--font-display); letter-spacing: -.03em; }
.ac-tier-card--premium .ac-tier-card__name { color: var(--fox-text); }
.ac-tier-card__rate { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; color: var(--ink-2); }
.ac-figure { font: 500 34px/1 var(--font-mono); letter-spacing: -.04em; color: var(--ink); }

/* Лестница уровней — тот же след по горизонтали: до текущего уровня линия в градиенте */
.ac-ladder { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ac-ladder__step { position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; text-align: center; }
.ac-ladder__step::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--rule-strong);
}
.ac-ladder__step:last-child::before { display: none; }
.ac-ladder__step.is-passed::before { background: var(--fox-gradient); }
.ac-ladder__node {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
}
.ac-ladder__node::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--rule-strong);
}
.ac-ladder__step.is-reached .ac-ladder__node::before { border-color: var(--fox); background: var(--fox); }
.ac-ladder__step.is-current .ac-ladder__node::before {
    width: 20px;
    height: 20px;
    border: 0;
    background: var(--fox-gradient);
    box-shadow: 0 0 0 5px var(--fox-ring);
}
.ac-ladder__label { font: 600 13px/1.2 var(--font-display); color: var(--ink-3); }
.ac-ladder__rate { font: 500 12px/1 var(--font-mono); color: var(--ink-3); }
.ac-ladder__step.is-reached .ac-ladder__label { color: var(--ink); }
.ac-ladder__step.is-current .ac-ladder__rate { color: var(--fox-text); }

.ac-manager { display: flex; align-items: flex-start; gap: 12px; padding-top: 16px; border-top: 1px solid var(--rule); }
.ac-manager__body { display: grid; gap: 2px; min-width: 0; }
.ac-manager__role { font: 600 11px/1.3 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ac-manager__name { font-weight: 500; overflow-wrap: anywhere; }
.ac-manager__links { list-style: none; padding: 0; display: grid; margin-top: 2px; }
.ac-manager__links a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    max-width: 100%;
    color: var(--ink);
    text-decoration: none;
}
.ac-manager__links a:hover { color: var(--fox-text); }
.ac-manager__links a span { overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.ac-manager__links .ac-icon { width: 18px; height: 18px; color: var(--ink-3); }

.ac-sections { display: grid; gap: 14px; }
.ac-section {
    display: grid;
    gap: 10px;
    align-content: start;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
.ac-section__icon {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--fox-soft);
    color: var(--fox-text);
}
.ac-section__title { font: 600 17px/1.3 var(--font-display); letter-spacing: -.01em; }
.ac-section__text { color: var(--ink-2); }
.ac-section__soon {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    border: 1px dashed var(--rule-strong);
    color: var(--ink-3);
    font: 500 13px/1.3 var(--font-text);
}
.ac-section__soon .ac-icon { width: 16px; height: 16px; }

/* ---------- 404: оборванный след ---------- */
.ac-lost { display: grid; justify-items: center; gap: 12px; padding: 40px 8px 56px; text-align: center; }
.ac-lost__trail { width: min(240px, 80%); height: auto; margin-bottom: 16px; overflow: visible; }
.ac-lost__walked { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.ac-lost__missing { fill: none; stroke: var(--rule-strong); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1 7; }
.ac-lost__node { fill: var(--trail-0); }
.ac-lost__node--last { fill: var(--trail-2); }
.ac-lost__node--lost { fill: var(--paper); stroke: var(--rule-strong); stroke-width: 2; stroke-dasharray: 3 3.5; }
.ac-lost__title { font: 700 30px/1.1 var(--font-display); letter-spacing: -.03em; }
.ac-lost .ac-btn { margin-top: 8px; }

/* ---------- Шире телефона ---------- */
@media (min-width: 480px) {
    .ac-bar .ac-avatar { display: inline-grid; }
}

@media (min-width: 600px) {
    :root { --gutter: 24px; }
    .ac-bar__inner { padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-bottom: 12px; gap: 16px; }
    .ac-bar__actions { gap: 8px; }
    .ac-logo__mark { width: 34px; height: 34px; }

    .ac-main { padding-top: 36px; padding-bottom: 64px; gap: 24px; }
    .ac-h1 { font-size: 38px; }
    .ac-lead { font-size: 17px; }
    .ac-tier-card { padding: 24px; }
    .ac-section { padding: 22px 24px; }

    .ac-login__card { padding: 28px 28px 30px; }
    .ac-login__title { font-size: 28px; }
    .ac-display { font-size: 46px; }
    .ac-lost__title { font-size: 36px; }
}

@media (min-width: 720px) {
    .ac-logo__sub, .ac-user__name { display: inline; }
}

/* Главная: приветствие и уровень рядом, разделы — в три колонки */
@media (min-width: 860px) {
    .ac-welcome { grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; }
    .ac-sections { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}

/* Вход на широком экране: след слева, карточка справа, всё по центру экрана */
@media (min-width: 960px) {
    .ac-login {
        grid-template-columns: minmax(0, 1fr) 420px;
        grid-template-areas: "story card";
        column-gap: clamp(56px, 7vw, 112px);
        align-items: center;
        align-content: center;
        padding-top: 16px;
        padding-bottom: 64px;
    }
    .ac-login__card { grid-area: card; }
    .ac-story { grid-area: story; gap: 22px; }
    .ac-display { font-size: clamp(52px, 2.6vw + 24px, 64px); }
    .ac-trail { margin-top: 14px; }
    .ac-trail__stage { padding-bottom: 26px; }
    .ac-trail__title { font-size: 17px; }
    .ac-trail__text { font-size: 15px; }
}

/* Совсем узкий экран (старые телефоны, 320px) */
@media (max-width: 359px) {
    .ac-bar .ac-tier { display: none; }
    .ac-bar--bare .ac-logo__sub { display: none; }
    .ac-otp.is-ready .ac-otp__slots { gap: 8px; }
    .ac-otp__group { gap: 5px; }
    .ac-otp__slot { height: 50px; font-size: 22px; }
}

/* ---------- Движение ---------- */
@media (prefers-reduced-motion: no-preference) {
    .ac-login__card { animation: ac-rise .6s cubic-bezier(.2, .7, .2, 1) both; }
    .ac-display, .ac-story .ac-lead { animation: ac-rise .6s cubic-bezier(.2, .7, .2, 1) .08s both; }

    /* След рисуется сверху вниз: точка, подпись, затем отрезок к следующей точке */
    .ac-trail__node { animation: ac-pop .45s cubic-bezier(.3, 1.5, .5, 1) var(--d) both; }
    .ac-trail__title, .ac-trail__text { animation: ac-rise .5s ease-out calc(var(--d) + .05s) both; }
    .ac-trail__line { clip-path: inset(0 0 100% 0); animation: ac-draw .5s ease-in-out calc(var(--d) + .2s) forwards; }
    .ac-trail__stage--goal .ac-trail__node {
        animation: ac-pop .45s cubic-bezier(.3, 1.5, .5, 1) var(--d) both, ac-beacon 1.6s ease-out calc(var(--d) + .5s) 2;
    }

    .ac-steps__item.is-current .ac-steps__bar::after { animation: ac-ping 2.2s ease-out infinite; }
    .ac-otp:focus-within .ac-otp__slot.is-active:empty::after { animation: ac-caret 1s steps(1) infinite; }
    .ac-otp.is-invalid .ac-otp__slots { animation: ac-shake .45s ease-in-out both; }
}

@keyframes ac-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ac-pop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes ac-draw { to { clip-path: inset(0 0 0 0); } }
@keyframes ac-beacon {
    0% { box-shadow: 0 0 0 5px var(--fox-ring), 0 0 0 5px rgba(247, 147, 30, .45); }
    100% { box-shadow: 0 0 0 5px var(--fox-ring), 0 0 0 22px rgba(247, 147, 30, 0); }
}
@keyframes ac-ping {
    0% { box-shadow: 0 0 0 0 rgba(247, 147, 30, .55); }
    70%, 100% { box-shadow: 0 0 0 9px rgba(247, 147, 30, 0); }
}
@keyframes ac-caret { 50% { opacity: 0; } }
@keyframes ac-shake {
    15%, 85% { transform: translateX(-2px); }
    30%, 70% { transform: translateX(4px); }
    45% { transform: translateX(-5px); }
    55% { transform: translateX(5px); }
}
