/*
 * Личный кабинет клиентов Vulpes — sup.vulpes.pro
 *
 * Фирменный стиль vulpes.uz: оранжевый, Montserrat, тёмная «ночная» тема как на сайте.
 * Главный элемент — «лисий трек»: статус обращения четырьмя сегментами,
 * залитыми градиентом логотипа до текущего шага.
 */

/* ---------- Шрифты: с этого же сервера, без внешних 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;
    --ink: #14161a;
    --ink-2: #555b66;
    --ink-3: #868c97;
    --rule: #e3e6eb;
    --rule-strong: #cfd4dc;
    --track-empty: #e6e8ec;

    --fox: #f7931e;
    --fox-hover: #e8830d;
    --fox-deep: #e2572a;
    --fox-text: #b4470c;
    --fox-soft: #fdeedd;
    --on-fox: #1a1208;
    --fox-gradient: linear-gradient(90deg, #e2572a 0%, #f7931e 100%);

    --new-fg: #1e4fd8;  --new-bg: #e9effe;
    --work-fg: #8f5400; --work-bg: #fcf0dc;
    --wait-fg: #c0262d; --wait-bg: #fde9e9;
    --done-fg: #13703a; --done-bg: #e2f4e9;
    --closed-fg: #4b5262; --closed-bg: #edeff3;

    --shadow: 0 1px 2px rgba(16, 20, 26, .04), 0 10px 30px -18px rgba(16, 20, 26, .18);
    --radius: 16px;
    --radius-sm: 12px;
    --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;
        --ink: #f2f2f3;
        --ink-2: #a8aab1;
        --ink-3: #75777f;
        --rule: #2b2b2f;
        --rule-strong: #3a3a40;
        --track-empty: #2c2c31;
        --fox: #fd9c12;
        --fox-hover: #ffad3a;
        --fox-deep: #f0612b;
        --fox-text: #ffb24d;
        --fox-soft: #2f210f;
        --fox-gradient: linear-gradient(90deg, #f0612b 0%, #fd9c12 100%);
        --new-fg: #8db2ff;  --new-bg: #172238;
        --work-fg: #ffc56e; --work-bg: #33250e;
        --wait-fg: #ff8e92; --wait-bg: #3a1718;
        --done-fg: #6fdb9e; --done-bg: #13301f;
        --closed-fg: #b9bcc4; --closed-bg: #27282d;
        --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 14px 34px -20px rgba(0, 0, 0, .7);
        --show-moon: none;
        --show-sun: inline-block;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #111112;
    --card: #1b1b1d;
    --field: #232326;
    --ink: #f2f2f3;
    --ink-2: #a8aab1;
    --ink-3: #75777f;
    --rule: #2b2b2f;
    --rule-strong: #3a3a40;
    --track-empty: #2c2c31;
    --fox: #fd9c12;
    --fox-hover: #ffad3a;
    --fox-deep: #f0612b;
    --fox-text: #ffb24d;
    --fox-soft: #2f210f;
    --fox-gradient: linear-gradient(90deg, #f0612b 0%, #fd9c12 100%);
    --new-fg: #8db2ff;  --new-bg: #172238;
    --work-fg: #ffc56e; --work-bg: #33250e;
    --wait-fg: #ff8e92; --wait-bg: #3a1718;
    --done-fg: #6fdb9e; --done-bg: #13301f;
    --closed-fg: #b9bcc4; --closed-bg: #27282d;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 14px 34px -20px rgba(0, 0, 0, .7);
    --show-moon: none;
    --show-sun: inline-block;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
.hd-body {
    margin: 0;
    min-height: 100vh;
    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(--fox); outline-offset: 2px; border-radius: 6px; }
h1, h2, p, figure, blockquote, dl, dd { margin: 0; }
.hd-muted { color: var(--ink-2); }
.hd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hd-icon { width: 20px; height: 20px; flex: none; }
.hd-eyebrow {
    font: 600 12px/1.3 var(--font-display);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fox-text);
}
.hd-h1 {
    font: 700 30px/1.2 var(--font-display);
    letter-spacing: -.02em;
    text-wrap: balance;
}
.hd-num {
    font: 500 13px/1 var(--font-mono);
    letter-spacing: .02em;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 5px 8px;
}
.hd-num--quiet { background: none; border: 0; padding: 0; color: var(--ink-3); }
.hd-dot { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; vertical-align: middle; margin: 0 8px; }
.hd-optional { font: 400 13px var(--font-text); color: var(--ink-3); text-transform: none; letter-spacing: 0; }

/* ---------- Шапка ---------- */
.hd-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--rule);
}
.hd-bar__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.hd-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.hd-logo:hover { color: var(--ink); }
.hd-logo__mark { width: 34px; height: 34px; object-fit: contain; }
.hd-logo__word { font: 700 20px/1 var(--font-display); letter-spacing: -.01em; }
.hd-logo__sub {
    font: 500 14px/1 var(--font-text);
    color: var(--ink-2);
    padding-left: 12px;
    border-left: 1px solid var(--rule-strong);
}
.hd-bar__actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hd-bar__logout { margin: 0; }
.hd-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.hd-icon-btn:hover { background: var(--field); border-color: var(--rule); color: var(--ink); }
.hd-theme-toggle .hd-icon--moon { display: var(--show-moon); }
.hd-theme-toggle .hd-icon--sun { display: var(--show-sun); }

.hd-user { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 6px; }
.hd-user__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.hd-user__name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-user__company { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-avatar {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fox-gradient);
    color: #fff;
    font: 600 13px/1 var(--font-display);
    letter-spacing: .02em;
}
.hd-avatar--staff { background: var(--ink); color: var(--card); }
a.hd-user { color: var(--ink); text-decoration: none; border-radius: 12px; padding: 3px 10px 3px 3px; transition: background-color .15s; }
a.hd-user:hover, a.hd-user.is-active { background: var(--field); color: var(--ink); }

/* ---------- Каркас ---------- */
.hd-main {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.hd-footer {
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 28px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--ink-3);
}
.hd-footer a { color: var(--ink-3); }

.hd-toast, .hd-alert { border-radius: var(--radius-sm); padding: 12px 16px; }
.hd-toast { display: flex; align-items: flex-start; gap: 10px; background: var(--done-bg); color: var(--done-fg); }
.hd-alert { background: var(--wait-bg); color: var(--wait-fg); display: grid; gap: 4px; }

/* ---------- Кнопки ---------- */
.hd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: 600 14px/1.2 var(--font-display);
    letter-spacing: .01em;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.hd-btn--primary { background: var(--fox); color: var(--on-fox); box-shadow: 0 8px 20px -12px rgba(226, 87, 42, .7); }
.hd-btn--primary:hover { background: var(--fox-hover); color: var(--on-fox); }
.hd-btn--secondary { background: var(--card); color: var(--ink); border-color: var(--rule-strong); }
.hd-btn--secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.hd-btn--ghost { background: transparent; color: var(--ink-2); }
.hd-btn--ghost:hover { background: var(--field); color: var(--ink); }
.hd-btn--small { min-height: 36px; padding: 8px 14px; font-size: 13px; }
.hd-btn--block { width: 100%; }
.hd-btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Поля ---------- */
.hd-form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.hd-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 0; padding: 0; margin: 0; }
.hd-field__label { font: 600 13px/1.3 var(--font-display); letter-spacing: .01em; color: var(--ink); padding: 0; }
.hd-field__hint { font-size: 13px; color: var(--ink-3); }
.hd-input {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule-strong);
    background: var(--field);
    color: var(--ink);
    font: 400 15px/1.45 var(--font-text);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.hd-input::placeholder { color: var(--ink-3); }
.hd-input:hover { border-color: var(--ink-3); }
.hd-input:focus { outline: none; border-color: var(--fox); background: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fox) 22%, transparent); }
.hd-textarea { resize: vertical; min-height: 110px; }
.hd-input--mono { font-family: var(--font-mono); letter-spacing: .04em; }
.hd-input--code { font: 500 26px/1 var(--font-mono); letter-spacing: .45em; text-align: center; padding-left: .45em; }
.hd-select {
    appearance: none;
    padding-right: 40px;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
    background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

/* ---------- Заголовок страницы ---------- */
.hd-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.hd-page-head > div { display: grid; gap: 6px; }
.hd-page-head--stack { flex-direction: column; align-items: flex-start; gap: 6px; }
.hd-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    font: 500 14px var(--font-text);
    color: var(--ink-2);
    text-decoration: none;
    margin-bottom: -8px;
}
.hd-back:hover { color: var(--ink); }

/* ---------- Сегменты «Открытые / Закрытые / Все» ---------- */
.hd-seg {
    display: inline-flex;
    gap: 4px;
    align-self: flex-start;
    padding: 4px;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 14px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.hd-seg::-webkit-scrollbar { display: none; }
.hd-seg__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--ink-2);
    font: 600 14px/1.2 var(--font-display);
    text-decoration: none;
    white-space: nowrap;
}
.hd-seg__item:hover { color: var(--ink); background: var(--field); }
.hd-seg__item.is-active { background: var(--ink); color: var(--card); }
.hd-seg__count { font: 500 12px/1 var(--font-mono); opacity: .75; }

/* ---------- Список обращений ---------- */
.hd-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.hd-row + .hd-row { border-top: 1px solid var(--rule); }
.hd-row__link {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    color: var(--ink);
    text-decoration: none;
    position: relative;
    transition: background-color .15s;
}
.hd-row__link:hover { background: var(--field); color: var(--ink); }
.hd-row--attention .hd-row__link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--fox-gradient);
}
.hd-row__num { font: 500 13px/1 var(--font-mono); color: var(--ink-3); }
.hd-row__main { display: grid; gap: 4px; min-width: 0; }
.hd-row__title { font: 600 15px/1.35 var(--font-display); letter-spacing: -.005em; overflow-wrap: anywhere; }
.hd-row__meta { font-size: 13px; color: var(--ink-3); }
.hd-row__state { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.hd-minitrack { display: inline-flex; gap: 3px; }
.hd-minitrack i { width: 16px; height: 4px; border-radius: 2px; background: var(--track-empty); }
.hd-minitrack i.is-on { background: var(--fox-gradient); }
.hd-minitrack--rejected i.is-on { background: var(--closed-fg); }

.hd-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font: 600 12px/1.3 var(--font-display);
    letter-spacing: .01em;
    white-space: nowrap;
}
.hd-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.hd-pill--new { color: var(--new-fg); background: var(--new-bg); }
.hd-pill--work { color: var(--work-fg); background: var(--work-bg); }
.hd-pill--wait { color: var(--wait-fg); background: var(--wait-bg); }
.hd-pill--resolved { color: var(--done-fg); background: var(--done-bg); }
.hd-pill--closed, .hd-pill--rejected { color: var(--closed-fg); background: var(--closed-bg); }

.hd-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    text-align: center;
    padding: 56px 24px;
    background: var(--card);
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius);
}
.hd-empty__icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--fox-soft); color: var(--fox-text); }
.hd-empty__title { font: 600 18px/1.3 var(--font-display); }
.hd-empty .hd-btn { margin-top: 8px; }

.hd-pager { display: flex; flex-wrap: wrap; gap: 6px; }
.hd-pager__page {
    min-width: 38px;
    padding: 8px 10px;
    text-align: center;
    border-radius: 10px;
    border: 1px solid var(--rule);
    background: var(--card);
    color: var(--ink);
    font: 500 13px var(--font-mono);
    text-decoration: none;
}
.hd-pager__page.is-active { background: var(--ink); color: var(--card); border-color: var(--ink); }

/* ---------- Карточки ---------- */
.hd-card {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}
.hd-card__title {
    font: 600 12px/1.3 var(--font-display);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 12px;
}
.hd-card__title--gap { margin-top: 24px; }
.hd-prose { overflow-wrap: anywhere; }

/* ---------- Обращение ---------- */
.hd-ticket-head { display: grid; gap: 12px; }
.hd-ticket-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 14px; color: var(--ink-2); }
.hd-ticket-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hd-ticket-head__title { overflow-wrap: anywhere; }
.hd-ticket-head__row .hd-pill { margin-top: 6px; }
.hd-prio { display: inline-flex; align-items: center; gap: 6px; }
.hd-prio::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.hd-prio--medium::before { background: var(--work-fg); }
.hd-prio--high::before { background: var(--fox); }
.hd-prio--critical::before { background: var(--wait-fg); box-shadow: 0 0 0 3px var(--wait-bg); }
.hd-prio--critical { color: var(--wait-fg); font-weight: 500; }

/* ---------- «Лисий трек» ---------- */
.hd-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.hd-track__step { display: grid; gap: 10px; min-width: 0; }
.hd-track__bar { position: relative; height: 8px; border-radius: 999px; background: var(--track-empty); overflow: hidden; }
.hd-track__step.is-done .hd-track__bar { background: var(--fox-gradient); }
.hd-track__step.is-current .hd-track__bar::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 58%;
    border-radius: inherit;
    background: var(--fox-gradient);
    animation: hd-fill .9s cubic-bezier(.2, .7, .2, 1) both;
}
.hd-track__step.is-current .hd-track__bar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(58% - 8px);
    width: 8px;
    border-radius: 50%;
    background: #fff;
    opacity: .85;
    animation: hd-pulse 2.4s ease-in-out .9s infinite;
}
.hd-track__step.is-rejected .hd-track__bar { background: var(--closed-fg); }
.hd-track__label { font: 600 14px/1.25 var(--font-display); color: var(--ink-3); }
.hd-track__step.is-done .hd-track__label, .hd-track__step.is-current .hd-track__label { color: var(--ink); }
.hd-track__date { font-size: 12px; color: var(--ink-3); min-height: 16px; }
.hd-track-card { padding: 22px 24px 18px; }
.hd-track-card__deadline { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--rule); font-size: 14px; color: var(--ink-2); }

@keyframes hd-fill { from { width: 0; } }
@keyframes hd-pulse { 0%, 100% { opacity: .15; } 50% { opacity: .9; } }

/* ---------- Действия клиента ---------- */
.hd-callout { display: grid; gap: 10px; justify-items: start; border-radius: var(--radius); padding: 20px 24px; border: 1px solid transparent; }
.hd-callout__title { font: 600 17px/1.3 var(--font-display); }
.hd-callout--wait { background: var(--wait-bg); border-color: color-mix(in srgb, var(--wait-fg) 22%, transparent); }
.hd-callout--wait .hd-callout__title { color: var(--wait-fg); }
.hd-callout--resolved { background: var(--done-bg); border-color: color-mix(in srgb, var(--done-fg) 22%, transparent); }
.hd-callout--resolved .hd-callout__title { color: var(--done-fg); }
.hd-callout--rate { background: var(--card); border-color: var(--rule); box-shadow: var(--shadow); }
.hd-callout__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; width: 100%; }
.hd-callout__actions > form { margin: 0; }
.hd-quote { border-left: 3px solid var(--done-fg); padding: 2px 0 2px 14px; overflow-wrap: anywhere; }
.hd-reopen { flex: 1 1 280px; }
.hd-reopen summary { list-style: none; display: inline-flex; }
.hd-reopen summary::-webkit-details-marker { display: none; }
.hd-reopen[open] summary { margin-bottom: 14px; }
.hd-rated { color: var(--ink-2); }

.hd-stars { border: 0; padding: 0; margin: 0; display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.hd-stars input { position: absolute; opacity: 0; pointer-events: none; }
.hd-stars label { cursor: pointer; line-height: 0; }
.hd-stars svg { fill: var(--track-empty); transition: fill .12s, transform .12s; }
.hd-stars input:checked ~ label svg, .hd-stars label:hover svg, .hd-stars label:hover ~ label svg { fill: var(--fox); }
.hd-stars label:hover svg { transform: scale(1.08); }
.hd-stars input:focus-visible + label { outline: 2px solid var(--fox); outline-offset: 2px; border-radius: 6px; }

/* ---------- Раскладка обращения ---------- */
.hd-ticket { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.hd-ticket__main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hd-ticket__side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.hd-details { display: grid; gap: 16px; }
.hd-details dt { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.hd-details dd { font-weight: 500; overflow-wrap: anywhere; }
.hd-details .hd-details__note { margin-top: 4px; font-size: 12px; font-weight: 400; line-height: 1.45; color: var(--ink-3); }
.hd-details .hd-details__text { font-size: 14px; font-weight: 400; line-height: 1.5; color: var(--ink-2); }
.hd-details__ok { display: inline-flex; align-items: center; gap: 6px; color: var(--done-fg); }
.hd-details__ok .hd-icon { width: 16px; height: 16px; }

/* ---------- Две колонки: содержимое и боковая колонка (список, профиль) ---------- */
.hd-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.hd-split__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hd-split__side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Связаться с поддержкой ---------- */
.hd-contacts { display: grid; gap: 14px; }
.hd-contacts .hd-card__title { margin-bottom: 0; }
.hd-contacts__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hd-contacts__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin: 0 -10px;
    padding: 7px 10px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color .15s;
}
.hd-contacts__link:hover { background: var(--field); color: var(--ink); }
.hd-contacts__icon { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--fox-soft); color: var(--fox-text); }
.hd-contacts__icon .hd-icon { width: 18px; height: 18px; }
.hd-contacts__value { font: 500 14px/1.3 var(--font-text); overflow-wrap: anywhere; }
.hd-contacts__link--phone .hd-contacts__value { font: 600 17px/1.2 var(--font-display); letter-spacing: -.005em; }
.hd-contacts__hours { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.hd-contacts__hours .hd-icon { width: 16px; height: 16px; color: var(--ink-3); }
.hd-contacts__note { padding-top: 12px; border-top: 1px dashed var(--rule); font-size: 13px; line-height: 1.5; color: var(--ink-3); }

/* ---------- Профиль ---------- */
.hd-profile__names { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.hd-profile__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.hd-attachments { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hd-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--field);
    border: 1px solid var(--rule);
    color: var(--ink);
    font-size: 14px;
    text-decoration: none;
}
.hd-attachment:hover { border-color: var(--fox); color: var(--ink); }
.hd-attachment .hd-icon { width: 16px; height: 16px; color: var(--ink-3); }
.hd-attachment__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-attachment__size { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ---------- Переписка ---------- */
.hd-thread { display: flex; flex-direction: column; gap: 14px; }
.hd-thread > .hd-card__title { margin: 8px 0 0; }
.hd-event { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--ink-3); text-align: center; }
.hd-event__text { font-weight: 500; color: var(--ink-2); }
.hd-event__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--new-fg); }
.hd-event__dot--work { background: var(--work-fg); }
.hd-event__dot--wait { background: var(--wait-fg); }
.hd-event__dot--resolved { background: var(--done-fg); }
.hd-event__dot--closed, .hd-event__dot--rejected { background: var(--closed-fg); }
.hd-msg { display: flex; align-items: flex-start; gap: 12px; max-width: 86%; }
.hd-msg--mine { align-self: flex-end; }
.hd-msg__bubble {
    min-width: 0;
    padding: 14px 16px;
    border-radius: 4px 16px 16px 16px;
    background: var(--card);
    border: 1px solid var(--rule);
    box-shadow: var(--shadow);
}
.hd-msg--mine .hd-msg__bubble { border-radius: 16px 4px 16px 16px; background: var(--fox-soft); border-color: color-mix(in srgb, var(--fox) 30%, transparent); box-shadow: none; }
.hd-msg__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.hd-msg__author { font: 600 14px/1.3 var(--font-display); }
.hd-msg__role { font-size: 12px; color: var(--fox-text); font-weight: 500; }
.hd-msg__time { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.hd-msg .hd-attachments { margin-top: 10px; }

.hd-reply__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hd-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--ink-2);
    font: 500 14px var(--font-text);
    cursor: pointer;
    position: relative;
}
.hd-attach-btn:hover { background: var(--field); color: var(--ink); }
.hd-attach-btn:focus-within { outline: 2px solid var(--fox); outline-offset: 2px; }
.hd-drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.hd-filelist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hd-filelist li { padding: 6px 10px; border-radius: 8px; background: var(--field); border: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); }

/* ---------- Новое обращение ---------- */
.hd-compose { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.hd-compose__section { padding: 22px 24px; display: grid; gap: 18px; }
.hd-compose__section + .hd-compose__section { border-top: 1px solid var(--rule); }
.hd-compose__grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.hd-compose__actions { display: flex; flex-wrap: wrap; gap: 12px; padding: 18px 24px; background: var(--field); border-top: 1px solid var(--rule); }

.hd-compose__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); gap: 18px; align-items: start; }

/* Четыре приоритета: 2×2, на широком экране — в ряд; без «сироты» в последней строке */
.hd-priority__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 1040px) { .hd-priority__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 480px) { .hd-priority__grid { grid-template-columns: 1fr; } }
.hd-priority__option {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule-strong);
    background: var(--card);
    cursor: pointer;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.hd-priority__option:hover { border-color: var(--ink-3); }
.hd-priority__option input { position: absolute; opacity: 0; pointer-events: none; }
.hd-priority__option::before { content: ""; flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--ink-3); }
.hd-priority__option--medium::before { background: var(--work-fg); }
.hd-priority__option--high::before { background: var(--fox); }
.hd-priority__option--critical::before { background: var(--wait-fg); }
.hd-priority__option:has(input:checked) { border-color: var(--fox); background: var(--fox-soft); box-shadow: 0 0 0 1px var(--fox) inset; }
.hd-priority__option:has(input:focus-visible) { outline: 2px solid var(--fox); outline-offset: 2px; }
.hd-priority__body { display: grid; gap: 2px; }
.hd-priority__name { font: 600 14px/1.3 var(--font-display); }
.hd-priority__hint { font-size: 13px; color: var(--ink-2); }
.hd-urgent {
    display: none;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--wait-bg);
    color: var(--wait-fg);
    font-size: 14px;
}
.hd-urgent .hd-icon { width: 18px; height: 18px; margin-top: 1px; }
.hd-urgent a { color: inherit; font-weight: 500; white-space: nowrap; }
.hd-priority:has(input[value="critical"]:checked, input[value="high"]:checked) .hd-urgent { display: flex; }

.hd-drop {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 24px;
    border-radius: var(--radius-sm);
    border: 1.5px dashed var(--rule-strong);
    background: var(--field);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.hd-drop:hover, .hd-drop.is-over { border-color: var(--fox); background: var(--fox-soft); }
.hd-drop:focus-within { outline: 2px solid var(--fox); outline-offset: 2px; }
.hd-drop__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--card); color: var(--fox-text); border: 1px solid var(--rule); }
.hd-drop__text { font: 600 14px var(--font-display); }
.hd-drop__hint { font-size: 13px; color: var(--ink-3); }

/* ---------- Вход ---------- */
.hd-auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.hd-auth__brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 40px 56px;
    background:
        radial-gradient(120% 70% at 0% 100%, rgba(240, 97, 43, .28), transparent 60%),
        radial-gradient(60% 50% at 100% 0%, rgba(253, 156, 18, .10), transparent 70%),
        #111112;
    color: #f2f2f3;
}
.hd-auth__watermark {
    position: absolute;
    right: -120px;
    bottom: -90px;
    width: 520px;
    max-width: none;
    opacity: .07;
    pointer-events: none;
    user-select: none;
}
.hd-logo--inverse { color: #f2f2f3; position: relative; }
.hd-logo--inverse:hover { color: #fff; }
.hd-logo--inverse .hd-logo__mark { width: 40px; height: 40px; }
.hd-logo--inverse .hd-logo__word { font-size: 22px; }
.hd-logo--inverse .hd-logo__sub { color: #a8aab1; border-left-color: #3a3a40; }
.hd-auth__pitch { position: relative; display: grid; gap: 18px; max-width: 520px; }
.hd-auth__title { font: 700 40px/1.12 var(--font-display); letter-spacing: -.025em; text-wrap: balance; }
.hd-auth__lead { font-size: 17px; line-height: 1.55; color: #c5c7cd; max-width: 46ch; }
.hd-demo {
    margin-top: 14px;
    padding: 20px 20px 16px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
}
.hd-track--demo .hd-track__bar { background: rgba(255, 255, 255, .12); }
.hd-track--demo .hd-track__step.is-done .hd-track__bar { background: linear-gradient(90deg, #f0612b, #fd9c12); }
.hd-track--demo .hd-track__step.is-current .hd-track__bar::before { background: linear-gradient(90deg, #f0612b, #fd9c12); }
.hd-track--demo .hd-track__label { color: #75777f; font-size: 13px; }
.hd-track--demo .hd-track__step.is-done .hd-track__label,
.hd-track--demo .hd-track__step.is-current .hd-track__label { color: #f2f2f3; }
.hd-demo__caption { margin-top: 14px; font-size: 13px; color: #a8aab1; }
.hd-auth__foot { position: relative; font-size: 13px; color: #75777f; }

.hd-auth__panel { position: relative; display: grid; place-items: center; padding: 88px 32px 48px; background: var(--paper); }
.hd-auth__tools { position: absolute; top: 20px; right: 20px; }
.hd-auth__form { width: 100%; max-width: 400px; display: grid; gap: 16px; }
.hd-auth__heading { font: 700 28px/1.2 var(--font-display); letter-spacing: -.02em; }
.hd-auth__hint { font-size: 13px; color: var(--ink-3); }
.hd-auth__alt { font-size: 14px; }
.hd-auth__step { display: grid; gap: 16px; }
.hd-auth__step[hidden] { display: none; }
/* Подпись слева, контакты — столбиком справа: иконки и адреса на одной вертикали */
.hd-auth__contacts {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px 16px;
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
    font-size: 13px;
    line-height: 20px;
    color: var(--ink-3);
}
.hd-auth__contacts-label { grid-column: 1; grid-row: 1; }
.hd-auth__contacts a { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.hd-auth__contacts a:hover { color: var(--fox-text); }
.hd-auth__contacts .hd-icon { width: 16px; height: 16px; color: var(--fox-text); }

.hd-tg-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule);
    background: var(--card);
    color: var(--ink-2);
    font-size: 14px;
}
.hd-tg-status[hidden] { display: none; }
.hd-spinner { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule-strong); border-top-color: var(--fox); animation: hd-spin .8s linear infinite; }
@keyframes hd-spin { to { transform: rotate(360deg); } }

/* ---------- Внутри Telegram: фирменная панель — только логотип, «Назад» — кнопка Telegram ---------- */
.hd-tg .hd-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.hd-tg .hd-auth__brand { padding: 16px 20px; gap: 0; }
.hd-tg .hd-auth__pitch, .hd-tg .hd-auth__foot, .hd-tg .hd-auth__watermark { display: none; }
.hd-tg .hd-auth__panel { place-items: start center; padding: 28px 20px calc(40px + env(safe-area-inset-bottom)); }
.hd-tg .hd-footer { display: none; }
.hd-tg .hd-main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.hd-tg-ready .hd-back { display: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 1000px) {
    .hd-auth { grid-template-columns: 1fr; }
    .hd-auth__brand { padding: 28px 24px 32px; gap: 28px; }
    .hd-auth__title { font-size: 30px; }
    .hd-auth__lead { font-size: 15px; }
    .hd-auth__watermark { width: 360px; right: -110px; bottom: -80px; }
    .hd-auth__foot { display: none; }
    .hd-auth__panel { place-items: start center; padding: 40px 20px 48px; }
    .hd-auth__tools { top: 12px; right: 12px; }
}
@media (max-width: 860px) {
    .hd-ticket, .hd-split { grid-template-columns: 1fr; }
    .hd-ticket__side, .hd-split__side { position: static; }
}
@media (max-width: 680px) {
    .hd-bar__inner { padding: 10px 16px; }
    .hd-logo__sub, .hd-user__text { display: none; }
    .hd-user { padding: 0; }
    .hd-main { padding: 22px 16px 48px; gap: 20px; }
    .hd-footer { padding: 0 16px 24px; }
    .hd-h1 { font-size: 24px; }
    .hd-card, .hd-compose__section, .hd-callout, .hd-track-card { padding-left: 18px; padding-right: 18px; }
    .hd-compose__actions { padding: 16px 18px; }
    .hd-row__link { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; }
    .hd-row__num { grid-column: 1; }
    .hd-row__main { grid-column: 1 / -1; grid-row: 2; }
    .hd-row__state { grid-column: 2; grid-row: 1; flex-direction: row-reverse; align-items: center; }
    .hd-track { gap: 6px; }
    .hd-track__label { font-size: 12px; }
    .hd-track__date { font-size: 11px; }
    .hd-msg { max-width: 100%; }
    .hd-msg:not(.hd-msg--mine) .hd-avatar { display: none; }
    .hd-ticket-head__row { flex-direction: column; gap: 10px; }
    .hd-ticket-head__row .hd-pill { margin-top: 0; }
    .hd-page-head .hd-btn { width: 100%; }
    .hd-compose__row, .hd-profile__names, .hd-profile__pair { grid-template-columns: 1fr; }
    a.hd-user { padding: 3px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
