/* ==========================================================================
   Техподдержка (support.php) — дизайн 2026, с нуля
   Монохром: чёрное на белом в светлой теме, белое на чёрно-синем в тёмной
   (<html data-tp-theme="dark">). Цвет — только для смысла (успех, ошибка).
   Поверхности берутся из токенов темы --tp-* (themes/BTPro_v24/theme.css).
   Разметка: префикс .hd-*, корень #hd (контейнер-запросы «hd»).

   1. Токены  2. Основа  3. Кнопки  4. Шапка  5. Сетка  6. Секции формы
   7. Темы обращения  8. Поля  9. Редактор  10. Контакты  11. Капча
   12. Подвал формы  13. Заметки  14. Боковая колонка  15. Готово  16. Адаптив
   ========================================================================== */

/* 1. Токены ---------------------------------------------------------------- */
#hd {
    --hd-bg: var(--tp-surface, #fff);
    --hd-bg-2: var(--tp-surface-2, #f6f7f9);
    --hd-bg-3: var(--tp-surface-3, #eef0f3);
    --hd-line: var(--tp-border, #e4e7ec);
    --hd-line-2: var(--tp-border-strong, #d0d5dd);
    --hd-text: var(--tp-text, #0b0d12);
    --hd-text-2: var(--tp-text-2, #344054);
    --hd-muted: var(--tp-muted, #667085);
    --hd-ink: #0b0d12;
    --hd-on-ink: #ffffff;
    --hd-ink-soft: rgba(11, 13, 18, .05);
    --hd-ring: rgba(11, 13, 18, .14);
    --hd-ok: #12a150;
    --hd-ok-soft: rgba(18, 161, 80, .09);
    --hd-err: #d92d20;
    --hd-err-soft: rgba(217, 45, 32, .07);
    --hd-r: 14px;
    --hd-r-sm: 9px;
    --hd-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

:root[data-tp-theme="dark"] #hd {
    --hd-ink: #f2f5fa;
    --hd-on-ink: #0a0f1c;
    --hd-ink-soft: rgba(242, 245, 250, .06);
    --hd-ring: rgba(242, 245, 250, .2);
    --hd-ok: #3ccb7f;
    --hd-ok-soft: rgba(60, 203, 127, .12);
    --hd-err: #ff7b72;
    --hd-err-soft: rgba(255, 123, 114, .11);
    --hd-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* 2. Основа ---------------------------------------------------------------- */
#hd {
    container: hd / inline-size;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    margin: 0 0 14px;
    color: var(--hd-text);
    font-family: var(--tp-font, Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
    font-size: 13.5px;
    line-height: 1.45;
    text-align: left;
}
#hd *, #hd *::before, #hd *::after { box-sizing: border-box; }
#hd [hidden] { display: none !important; }
#hd a { color: var(--hd-text); text-decoration: none; }
#hd h1, #hd h2, #hd h3, #hd p, #hd ul, #hd ol { margin: 0; padding: 0; color: inherit; }
#hd ul, #hd ol { list-style: none; }
#hd :focus-visible { outline: 2px solid var(--hd-ink); outline-offset: 2px; }

#hd .hd-box {
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-r);
    background: var(--hd-bg);
    box-shadow: var(--hd-shadow);
}

/* 3. Кнопки ---------------------------------------------------------------- */
#hd .hd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid var(--hd-ink);
    border-radius: var(--hd-r-sm);
    background: var(--hd-ink);
    color: var(--hd-on-ink);
    font: 600 12.5px/1 var(--tp-font, inherit);
    white-space: nowrap;
    cursor: pointer;
    transition: opacity .15s, background .15s, border-color .15s;
}
#hd .hd-btn:hover { opacity: .86; }
#hd .hd-btn[disabled] { opacity: .45; cursor: not-allowed; }
#hd .hd-btn--ghost {
    border-color: var(--hd-line-2);
    background: transparent;
    color: var(--hd-text);
}
#hd .hd-btn--ghost:hover { opacity: 1; border-color: var(--hd-ink); background: var(--hd-ink-soft); }
#hd .hd-btn--lg { height: 40px; padding: 0 18px; font-size: 13.5px; }
#hd .hd-btn.is-busy i { animation: hd-spin .8s linear infinite; }
#hd .hd-btn.is-busy i::before { content: "\f110"; }

@keyframes hd-spin { to { transform: rotate(360deg); } }

/* 4. Шапка ----------------------------------------------------------------- */
#hd .hd-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}
#hd .hd-head__ico {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--hd-ink);
    color: var(--hd-on-ink);
    font-size: 18px;
}
#hd .hd-head__t { flex: 1 1 auto; min-width: 0; }
#hd .hd-h1 { font-size: 18px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
#hd .hd-sub { margin-top: 2px; color: var(--hd-muted); font-size: 12.5px; }
#hd .hd-head__links { display: flex; gap: 6px; flex: 0 0 auto; }

/* 5. Сетка ----------------------------------------------------------------- */
#hd .hd-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}
#hd .hd-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#hd .hd-aside { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

@container hd (min-width: 820px) {
    #hd .hd-grid { grid-template-columns: minmax(0, 1fr) 270px; }
    #hd .hd-aside { position: sticky; top: 70px; }
}

/* 6. Секции формы ---------------------------------------------------------- */
#hd .hd-form { padding: 4px 0 0; }
#hd .hd-sec { padding: 14px 16px; }
#hd .hd-sec + .hd-sec { border-top: 1px solid var(--hd-line); }
#hd .hd-sec__h {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 11px;
    font-size: 13.5px;
    font-weight: 700;
}
#hd .hd-sec__h small { margin-left: auto; color: var(--hd-muted); font-size: 11.5px; font-weight: 500; }
#hd .hd-step {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--hd-ink);
    color: var(--hd-text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
#hd .hd-sec.is-done .hd-step { background: var(--hd-ink); color: var(--hd-on-ink); }

#hd .hd-me {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--hd-line);
    background: var(--hd-bg-2);
    color: var(--hd-text-2);
    font-size: 12.5px;
}
#hd .hd-me i { color: var(--hd-text); }
#hd .hd-me a { font-weight: 700; }
#hd .hd-me a:hover { text-decoration: underline; }
#hd .hd-me small { color: var(--hd-muted); }

/* 7. Темы обращения -------------------------------------------------------- */
#hd .hd-topics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 7px;
}
#hd .hd-topic {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-r-sm);
    background: var(--hd-bg);
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
#hd .hd-topic:hover { border-color: var(--hd-line-2); background: var(--hd-bg-2); }
#hd .hd-topic input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}
#hd .hd-topic__ico {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--hd-bg-3);
    color: var(--hd-text);
    font-size: 14px;
    transition: background .15s, color .15s;
}
#hd .hd-topic__t { display: flex; flex-direction: column; min-width: 0; }
#hd .hd-topic__t b { font-size: 12.5px; font-weight: 650; line-height: 1.25; }
#hd .hd-topic__t small { color: var(--hd-muted); font-size: 11.5px; line-height: 1.3; }
#hd .hd-topic:has(input:checked) {
    border-color: var(--hd-ink);
    box-shadow: 0 0 0 1px var(--hd-ink) inset;
    background: var(--hd-bg);
}
#hd .hd-topic:has(input:checked) .hd-topic__ico { background: var(--hd-ink); color: var(--hd-on-ink); }
#hd .hd-topic:has(input:focus-visible) { outline: 2px solid var(--hd-ink); outline-offset: 2px; }
#hd .hd-topics.is-invalid .hd-topic { border-color: var(--hd-err); }

/* 8. Поля ------------------------------------------------------------------ */
#hd .hd-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}
#hd .hd-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#hd .hd-label { font-size: 12px; font-weight: 600; color: var(--hd-text-2); }
#hd .hd-req { margin-left: 2px; color: var(--hd-err); }
#hd .hd-input {
    position: relative;
    display: flex;
    align-items: center;
}
#hd .hd-input > i,
#hd .hd-input > img {
    position: absolute;
    left: 11px;
    color: var(--hd-muted);
    font-size: 13px;
    pointer-events: none;
}
#hd .hd-input > img { width: 14px; height: 14px; border-radius: 3px; }
#hd .hd-in,
#hd .hd-input input {
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 11px 0 33px;
    border: 1px solid var(--hd-line-2);
    border-radius: var(--hd-r-sm);
    background: var(--hd-bg);
    color: var(--hd-text);
    font: 400 13px/1 var(--tp-font, inherit);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
#hd .hd-input input::placeholder { color: var(--hd-muted); opacity: .8; }
#hd .hd-input input:focus {
    outline: 0;
    border-color: var(--hd-ink);
    box-shadow: 0 0 0 3px var(--hd-ring);
}
#hd .hd-hint { color: var(--hd-muted); font-size: 11.5px; }

/* 9. Редактор -------------------------------------------------------------- */
#hd .hd-editor {
    border: 1px solid var(--hd-line-2);
    border-radius: var(--hd-r-sm);
    background: var(--hd-bg);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
#hd .hd-editor:focus-within { border-color: var(--hd-ink); box-shadow: 0 0 0 3px var(--hd-ring); }
#hd .hd-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--hd-line);
    background: var(--hd-bg-2);
}
#hd .hd-tool {
    display: grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--hd-text-2);
    font-size: 12px;
    cursor: pointer;
}
#hd .hd-tool:hover { background: var(--hd-bg-3); color: var(--hd-text); }
#hd .hd-tools__sep { width: 1px; height: 16px; margin: 0 4px; background: var(--hd-line-2); }
#hd .hd-tools__tpl {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    white-space: nowrap;
    padding: 0 8px;
    color: var(--hd-muted);
    font-size: 11.5px;
}
#hd .hd-tools__tpl:hover { color: var(--hd-text); }
#hd .hd-editor textarea {
    display: block;
    width: 100%;
    min-height: 170px;
    max-height: 60vh;
    margin: 0;
    padding: 11px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--hd-text);
    font: 400 13.5px/1.55 var(--tp-font, inherit);
    resize: vertical;
    box-shadow: none;
}
#hd .hd-editor textarea:focus { outline: 0; }
#hd .hd-editor textarea::placeholder { color: var(--hd-muted); opacity: .8; }
#hd .hd-editor__foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    border-top: 1px solid var(--hd-line);
    color: var(--hd-muted);
    font-size: 11.5px;
}
#hd .hd-count.is-max { color: var(--hd-err); font-weight: 600; }

/* 10. Контакты ------------------------------------------------------------- */
#hd .hd-more {
    margin-top: 10px;
    border: 1px dashed var(--hd-line-2);
    border-radius: var(--hd-r-sm);
}
#hd .hd-more > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
#hd .hd-more > summary::-webkit-details-marker { display: none; }
#hd .hd-more > summary small { color: var(--hd-muted); font-weight: 500; }
#hd .hd-more > summary .fa-chevron-down { margin-left: auto; color: var(--hd-muted); font-size: 11px; transition: transform .2s; }
#hd .hd-more[open] > summary .fa-chevron-down { transform: rotate(180deg); }
#hd .hd-more__body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    padding: 2px 12px 12px;
}

/* 11. Капча ---------------------------------------------------------------- */
#hd .hd-captcha { display: flex; align-items: stretch; gap: 8px; }
#hd .hd-captcha__img {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 4px 8px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-r-sm);
    background: var(--hd-bg-2);
    color: var(--hd-text);
    overflow: hidden;
}
#hd .hd-captcha__img pre {
    margin: 0 !important;
    background: transparent !important;
    color: inherit !important;
    border: 0 !important;
}
#hd .hd-iconbtn {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    border: 1px solid var(--hd-line-2);
    border-radius: var(--hd-r-sm);
    background: var(--hd-bg);
    color: var(--hd-text);
    cursor: pointer;
}
#hd .hd-iconbtn:hover { border-color: var(--hd-ink); }
#hd .hd-iconbtn.is-busy i { animation: hd-spin .8s linear infinite; }
#hd .hd-widget { min-height: 65px; }

/* согласие */
#hd .hd-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    color: var(--hd-text-2);
    font-size: 12.5px;
    cursor: pointer;
}
#hd .hd-check input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--hd-ink);
}
#hd .hd-gap { display: flex; flex-direction: column; gap: 12px; }

/* 12. Подвал формы --------------------------------------------------------- */
#hd .hd-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--hd-line);
    border-radius: 0 0 var(--hd-r) var(--hd-r);
    background: var(--hd-bg-2);
}
#hd .hd-foot__hint { color: var(--hd-muted); font-size: 11.5px; }
#hd .hd-foot__hint kbd {
    padding: 1px 5px;
    border: 1px solid var(--hd-line-2);
    border-radius: 4px;
    background: var(--hd-bg);
    color: var(--hd-text-2);
    font: 600 10.5px/1.4 var(--tp-font, inherit);
    box-shadow: none;
}
#hd .hd-foot .hd-btn { margin-left: auto; }

/* смена типа капчи (отдельная форма init_captcha_mode) */
#hd .hd-alt { display: flex; justify-content: center; }
#hd .hd-alt form { margin: 0; }
#hd .hd-alt input[type="submit"] {
    padding: 4px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--hd-muted);
    font: 500 11.5px/1.3 var(--tp-font, inherit);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
#hd .hd-alt input[type="submit"]:hover { color: var(--hd-text); }

/* 13. Заметки -------------------------------------------------------------- */
#hd .hd-note {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--hd-line);
    border-radius: var(--hd-r-sm);
    background: var(--hd-bg-2);
    color: var(--hd-text-2);
    font-size: 12.5px;
}
#hd .hd-note > i { margin-top: 2px; color: var(--hd-text); }
#hd .hd-note b { color: var(--hd-text); }
#hd .hd-note ul { margin-top: 3px; }
#hd .hd-note li { position: relative; padding-left: 12px; }
#hd .hd-note li::before { content: "\2013 "; position: absolute; left: 0; }
#hd .hd-note--err { border-color: var(--hd-err); background: var(--hd-err-soft); }
#hd .hd-note--err > i, #hd .hd-note--err b { color: var(--hd-err); }
#hd .hd-form > .hd-note { margin: 10px 16px 0; }
#hd .hd-topic-note { margin-top: 9px; }

/* 14. Боковая колонка ------------------------------------------------------ */
#hd .hd-card { padding: 13px 14px; }
#hd .hd-card__h {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
#hd .hd-card__h span { margin-left: auto; color: var(--hd-muted); font-weight: 600; letter-spacing: 0; }

#hd .hd-rules { display: flex; flex-direction: column; gap: 9px; }
#hd .hd-rules li { display: flex; gap: 9px; color: var(--hd-text-2); font-size: 12.5px; line-height: 1.4; }
#hd .hd-rules i { flex: 0 0 16px; margin-top: 2px; color: var(--hd-text); text-align: center; }

#hd .hd-tickets { display: flex; flex-direction: column; }
#hd .hd-ticket {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
    border-top: 1px solid var(--hd-line);
}
#hd .hd-ticket:first-child { border-top: 0; padding-top: 0; }
#hd .hd-ticket__t { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
#hd .hd-ticket__t b { overflow: hidden; font-size: 12.5px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
#hd .hd-ticket__t small { color: var(--hd-muted); font-size: 11px; }
#hd .hd-chip {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid var(--hd-line-2);
    border-radius: 999px;
    color: var(--hd-text-2);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
#hd .hd-chip--wait { border-color: var(--hd-ink); color: var(--hd-text); }
#hd .hd-chip--ok { border-color: transparent; background: var(--hd-ok-soft); color: var(--hd-ok); }
#hd .hd-empty { color: var(--hd-muted); font-size: 12.5px; }
#hd .hd-card__more { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 600; }
#hd .hd-card__more:hover { text-decoration: underline; }

/* 15. Готово --------------------------------------------------------------- */
#hd .hd-done {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 34px 20px 30px;
    text-align: center;
}
#hd .hd-done__ico {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--hd-ink);
    color: var(--hd-on-ink);
    font-size: 22px;
    animation: hd-pop .35s cubic-bezier(.2, .9, .3, 1.3);
}
#hd .hd-done h2 { font-size: 18px; font-weight: 700; }
#hd .hd-done p { max-width: 440px; color: var(--hd-muted); font-size: 13px; }
#hd .hd-done__act { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

@keyframes hd-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 16. Адаптив -------------------------------------------------------------- */
@container hd (max-width: 560px) {
    #hd .hd-head { flex-wrap: wrap; padding: 12px; }
    #hd .hd-head__links { width: 100%; }
    #hd .hd-head__links .hd-btn { flex: 1 1 0; }
    #hd .hd-sec { padding: 12px; }
    #hd .hd-me { padding: 9px 12px; }
    #hd .hd-topics { grid-template-columns: 1fr 1fr; }
    #hd .hd-topic { flex-direction: column; align-items: flex-start; gap: 7px; }
    #hd .hd-foot { padding: 12px; }
    #hd .hd-foot__hint { display: none; }
    #hd .hd-foot .hd-btn { width: 100%; }
    #hd .hd-form > .hd-note { margin: 10px 12px 0; }
}
@container hd (max-width: 360px) {
    #hd .hd-topics { grid-template-columns: 1fr; }
    #hd .hd-topic { flex-direction: row; align-items: center; }
}

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