/* Единый CSS для /free-widgets, /api-kursov-valyut-turoperatorov,
   /legal, /personal-data-consent, /oferta-api и /privacy-policy.
   Загружать один раз вместо tm-free-widgets.css + tm-api-page.css.
   Классы HTML и поведение форм сохранены. */

/* ============================================================
   tm-service.css — общий стиль страниц виджетов, API и документов
   Палитра и приёмы взяты из news-page.css / template.css,
   Один файл обслуживает .tmfw и .tmapi без изменения HTML.
   ============================================================ */

.tmfw {
    --tmfw-ink:      #0f2f52;   /* заголовки */
    --tmfw-text:     #35567f;   /* основной текст */
    --tmfw-muted:    #7a93b5;   /* второстепенный */
    --tmfw-link:     #2f6fb5;
    --tmfw-line:     #d8e5fb;   /* границы карточек */
    --tmfw-line-2:   #cfe2fb;   /* граница героя */
    --tmfw-bad:      #d64545;
    --tmfw-good:     #18a57a;
    --tmfw-card-sh:  0 10px 28px rgba(16, 55, 98, .05);

    padding: 0 0 16px;
    color: var(--tmfw-text);
}

/* ── Шапка ───────────────────────────────────────────────── */

.tmfw-hero {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    padding: 26px 28px 24px;
    margin-bottom: 18px;
    background:
        radial-gradient(circle at 12% 14%, rgba(255,255,255,.98) 0, rgba(255,255,255,0) 28%),
        linear-gradient(135deg, #edf6ff 0, #d9ecff 40%, #eaf7ff 70%, #f8fbff 100%);
    border: 1px solid var(--tmfw-line-2);
    box-shadow: 0 16px 40px rgba(15, 91, 215, .08);
}

.tmfw-hero__badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #e9f1ff 0, #f4f8ff 100%);
    border: 1px solid #d3e1fb;
    color: #2457a5;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.tmfw-hero__title {
    margin: 0 0 14px;
    font-size: 1.9rem;
    line-height: 1.15;
    letter-spacing: -.3px;
    color: var(--tmfw-ink);
    font-weight: 700;
}

.tmfw-hero__lead {
    margin: 0 0 16px;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--tmfw-text);
    max-width: 70ch;
}

.tmfw-hero__terms {
    margin: 0;
    padding: 14px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .75);
    border-left: 3px solid var(--tmfw-link);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--tmfw-text);
}

.tmfw-hero__terms a,
.tmfw a {
    color: var(--tmfw-link);
    font-weight: 500;
    text-decoration: none;
}

.tmfw-hero__terms a:hover,
.tmfw a:hover {
    text-decoration: underline;
}

/* ── Карточки ────────────────────────────────────────────── */

.tmfw-card {
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--tmfw-line);
    box-shadow: var(--tmfw-card-sh);
    line-height: 1.72;
}

.tmfw-card h2 {
    margin: 0 0 12px;
    color: #1f426d;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: normal;
}

.tmfw-card p {
    margin: 0 0 16px;
    max-width: 72ch;
    line-height: 1.78;
}

.tmfw-shot {
    margin: 0;
    padding: 0;
}

.tmfw-shot img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    border: 1px solid var(--tmfw-line);
    background: #f6faff;
}

/* Нумерованные шаги — как списки в теле новости */

.tmfw-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
    counter-reset: tmfw;
}

.tmfw-steps li {
    position: relative;
    padding-left: 28px;
    line-height: 1.7;
}

.tmfw-steps li::before {
    counter-increment: tmfw;
    content: counter(tmfw) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--tmfw-link);
    font-weight: 700;
}

/* ── Форма ───────────────────────────────────────────────── */

.tmfw-form-card {
    background: linear-gradient(180deg, #fff 0, #f9fbff 100%);
}

.tmfw-form-card > p {
    color: var(--tmfw-muted);
}

.tmfw-field {
    margin: 0 0 16px;
}

.tmfw-field > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: .92rem;
    color: #1f426d;
}

.tmfw-opt {
    font-weight: 400;
    color: var(--tmfw-muted);
}

.tmfw-field input[type="url"],
.tmfw-field input[type="email"],
.tmfw-field input[type="tel"],
.tmfw-field input[type="text"],
.tmfw-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--tmfw-line);
    border-radius: 14px;
    background: #fff;
    font: inherit;
    color: var(--tmfw-text);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.tmfw-field input::placeholder,
.tmfw-field textarea::placeholder {
    color: #a9bcd4;
}

.tmfw-field input:focus,
.tmfw-field textarea:focus {
    outline: none;
    border-color: #9fc2ec;
    box-shadow: 0 0 0 4px rgba(47, 111, 181, .1);
}

.tmfw-field input:focus-visible,
.tmfw-field textarea:focus-visible,
.tmfw-check input:focus-visible,
.tmfw-submit:focus-visible {
    outline: 2px solid var(--tmfw-link);
    outline-offset: 2px;
}

.tmfw-field.is-bad input,
.tmfw-field.is-bad textarea {
    border-color: var(--tmfw-bad);
}

/* Выбор виджетов — плитки, как вкладки на сайте */

.tmfw-checks {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

.tmfw-checks legend {
    padding: 0;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: .92rem;
    color: #1f426d;
}

.tmfw-checks.is-bad legend {
    color: var(--tmfw-bad);
}

.tmfw-checks__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.tmfw-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--tmfw-line);
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
    font-size: .95rem;
    color: #20324a;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.tmfw-check:hover {
    border-color: #bcd4f8;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(47, 111, 181, .1);
}

.tmfw-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--tmfw-link);
}

.tmfw-check:has(input:checked) {
    border-color: transparent;
    background: linear-gradient(135deg, #2f6fb5 0, #215e9f 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(32, 87, 151, .18);
}

.tmfw-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.tmfw-row > .tmfw-field {
    flex: 1 1 240px;
}

.tmfw-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.tmfw-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tmfw-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 26px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #2f6fb5 0, #215e9f 100%);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(32, 87, 151, .2);
    transition: transform .18s ease, box-shadow .18s ease;
}

.tmfw-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 28px rgba(32, 87, 151, .25);
}

.tmfw-submit[disabled] {
    opacity: .6;
    transform: none;
    cursor: default;
}

.tmfw-privacy {
    margin: 0;
    flex: 1 1 260px;
    font-size: .85rem;
    line-height: 1.6;
    color: var(--tmfw-muted);
}

.tmfw-msg {
    margin: 14px 0 0;
    min-height: 1.2em;
    line-height: 1.6;
}

.tmfw-msg.is-bad  { color: var(--tmfw-bad); }
.tmfw-msg.is-good { color: var(--tmfw-good); font-weight: 700; }

/* ── Мобильные ───────────────────────────────────────────── */

@media (max-width: 767px) {
    .tmfw-hero        { padding: 20px 18px; border-radius: 24px; }
    .tmfw-hero__title { font-size: 1.5rem; }
    .tmfw-card        { padding: 18px 16px; border-radius: 20px; }
    .tmfw-submit      { width: 100%; }
}

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

/* Блок FAQ плагина на этой странице: сверху вплотную к карточкам,
   снизу отступ как у остальных страниц. Модификатора --widgets
   в tmfaq.css нет, поэтому задаём здесь. */
.tmfaq-block.tmfaq-section--widgets {
    padding-top: 0;
    padding-bottom: 56px;
    margin-top: -24px;
}

/* Хлебные крошки — по образцу .tm-news-breadcrumb со страниц новостей */
.tmfw-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    font-size: .85rem;
    color: var(--tmfw-muted);
}

.tmfw-breadcrumb a {
    color: var(--tmfw-link);
    font-weight: 500;
    text-decoration: none;
}

.tmfw-breadcrumb a:hover {
    text-decoration: underline;
}

.tmfw-breadcrumb__sep {
    color: #b6c7dd;
}

@media (max-width: 767px) {
    .tmfw-breadcrumb { font-size: .8rem; }
}

/* Выключка по обоим краям, во всю ширину карточки.
   hyphens: auto включает переносы — без них в русском тексте
   при выключке получаются дыры между словами. */
.tmfw-hero__lead,
.tmfw-hero__terms,
.tmfw-card p,
.tmfw-steps li {
    max-width: none;
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

/* На узких экранах выключка вредит: строк мало, дыры заметнее */
@media (max-width: 560px) {
    .tmfw-hero__lead,
    .tmfw-hero__terms,
    .tmfw-card p,
    .tmfw-steps li {
        text-align: left;
        hyphens: manual;
    }
}

/* --- согласие на обработку ПД: читаемая ссылка в обычном и отмеченном состоянии --- */
.tmfw-consent a {
    color: var(--tmfw-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tmfw-consent input:checked + span {
    color: #ffffff;
}

.tmfw-consent input:checked + span a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tmfw-consent input:checked + span a:hover {
    color: #ffffff;
    opacity: .92;
}


/* Согласие ПД: ссылка должна оставаться читаемой на синем фоне */
.tmfw .tmfw-consent:has(input:checked) span,
.tmfw .tmfw-consent:has(input:checked) span a,
.tmfw .tmfw-consent:has(input:checked) span a:visited,
.tmfw .tmfw-consent:has(input:checked) span a:hover,
.tmfw .tmfw-consent:has(input:checked) span a:focus {
    color: #fff !important;
}

.tmfw .tmfw-consent:has(input:checked) span a {
    text-decoration: underline;
    text-underline-offset: 2px;
}


/* ============================================================
   Страницы API и юридические документы
   ============================================================ */

/*
   API, оферта и юридические документы: раздел общего tm-service.css.
   Общие цвета и формы берутся из .tmfw; сетки, таблицы и документы
   сохраняют собственные компоненты под .tmapi.
*/

.tmapi {
    --tmapi-ink: var(--tmfw-ink);
    --tmapi-text: var(--tmfw-text);
    --tmapi-mute: var(--tmfw-muted);
    --tmapi-line: var(--tmfw-line);
    --tmapi-border: var(--tmfw-line);
    --tmapi-soft: #f7fbff;
    --tmapi-accent: var(--tmfw-link);
    --tmapi-accent-soft: #eef6ff;

    font-size: 16px;
    line-height: 1.6;
    color: var(--tmapi-text);
}

.tmapi [hidden] {
    display: none !important;
}

/* --- типографика ---------------------------------------------------- */

.tmapi h2 {
    margin: 48px 0 6px;
    font-size: clamp(21px, 2.3vw, 27px);
    line-height: 1.22;
    font-weight: 700;
    color: var(--tmapi-ink);
    letter-spacing: -.01em;
}

.tmapi h2 + .tmapi-sub {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--tmapi-mute);
}

.tmapi h3 {
    margin: 32px 0 10px;
    font-size: clamp(16px, 1.7vw, 19px);
    line-height: 1.3;
    font-weight: 650;
    color: var(--tmapi-ink);
}

.tmapi h4 {
    margin: 22px 0 8px;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--tmapi-ink);
}

/* Текст идёт во всю ширину колонки, как таблицы и карточки, и
   выключается по формату. Переносы обязательны: без них выключка
   в русском тексте рвёт строки большими пробелами. Работают они
   только при указанном языке — он стоит на контейнере страницы. */
.tmapi p,
.tmapi li {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
    overflow-wrap: break-word;
}

/* Короткие служебные строки выключать не нужно — там это выглядит нелепо */
.tmapi .tmapi-toc li,
.tmapi .tmapi-toc a,
.tmapi .tmapi-sub,
.tmapi .tmapi-contacts,
.tmapi .tmapi-version,
.tmapi .tmapi-facts li,
.tmapi .tmapi-card p,
.tmapi .tmfw-msg,
.tmapi .tmapi-accept,
.tmapi .tmapi-accept span {
    text-align: left;
    hyphens: manual;
}

.tmapi p {
    margin: 0 0 14px;
}

.tmapi ul,
.tmapi ol {
    margin: 0 0 16px;
    padding-left: 22px;
}

.tmapi li {
    margin-bottom: 6px;
}

.tmapi a {
    color: var(--tmapi-accent);
}

/* --- шапка ---------------------------------------------------------- */

.tmapi-hero {
    margin: 0 0 8px;
    padding: 28px 30px 26px;
    border: 1px solid var(--tmapi-line);
    border-radius: 30px;
    background: linear-gradient(135deg, #edf6ff 0%, #d9ecff 40%, #eaf7ff 70%, #f8fbff 100%);
    box-shadow: 0 16px 40px rgba(15, 91, 215, .08);
}

.tmapi-hero__badge {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 11px;
    border-radius: 999px;
    background: linear-gradient(135deg, #e9f1ff 0%, #f4f8ff 100%);
    border: 1px solid #d3e1fb;
    color: #2457a5;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tmapi-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(26px, 3.4vw, 38px);
    line-height: 1.15;
    font-weight: 700;
    color: var(--tmapi-ink);
    letter-spacing: -.02em;
}

.tmapi-hero__lead {
    margin: 0 0 18px;
    font-size: 17px;
    line-height: 1.55;
    color: #41536b;
}

/* три факта под заголовком — заменяют абзац «кому это нужно» */
.tmapi-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-width: none;
}

.tmapi-facts li {
    margin: 0;
    padding-left: 13px;
    border-left: 3px solid var(--tmapi-accent);
    font-size: 14.5px;
    line-height: 1.45;
    color: #41536b;
}

.tmapi-facts b {
    display: block;
    color: var(--tmapi-ink);
    font-weight: 650;
}

/* --- сетка карточек -------------------------------------------------- */

.tmapi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 0 0 8px;
}

.tmapi-card {
    padding: 20px 22px;
    border: 1px solid var(--tmapi-line);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--tmfw-card-sh);
}

.tmapi-card h3 {
    margin: 0 0 8px;
    font-size: 16.5px;
}

.tmapi-card p {
    margin: 0;
    max-width: none;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--tmapi-text);
}

.tmapi-card__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--tmapi-accent-soft);
    color: var(--tmapi-accent);
    font-size: 14px;
    font-weight: 700;
}

/* --- таблицы --------------------------------------------------------- */

/* Обёртка со скроллом: сама таблица остаётся таблицей и занимает
   всю ширину. Если задать overflow прямо на table, она сожмётся
   по содержимому — именно это и портило страницу. */
.tmapi-scroll {
    margin: 0 0 18px;
    overflow-x: auto;
    border: 1px solid var(--tmapi-line);
    border-radius: 12px;
    background: #fff;
}

.tmapi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}

.tmapi-table th,
.tmapi-table td {
    padding: 11px 15px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #eef2f7;
}

.tmapi-table thead th {
    position: sticky;
    top: 0;
    font-weight: 650;
    color: var(--tmapi-ink);
    background: var(--tmapi-soft);
    border-bottom: 1.5px solid var(--tmapi-line);
    white-space: nowrap;
}

.tmapi-table tbody tr:last-child td {
    border-bottom: none;
}

.tmapi-table tbody tr:hover td {
    background: #fbfdff;
}

.tmapi-table td:first-child {
    color: var(--tmapi-ink);
    font-weight: 500;
}

/* тарифы: первая колонка шире, значения по центру */
.tmapi-plans .tmapi-table th:not(:first-child),
.tmapi-plans .tmapi-table td:not(:first-child) {
    text-align: center;
    white-space: nowrap;
}

.tmapi-plans .tmapi-table th:first-child,
.tmapi-plans .tmapi-table td:first-child {
    width: 34%;
}

.tmapi-plan-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--tmapi-ink);
}

.tmapi-price {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tmapi-accent);
    white-space: nowrap;
}

.tmapi-yes {
    color: #15803d;
    font-weight: 600;
}

.tmapi-no {
    color: #cbd5e1;
}

/* справочники кодов — плотнее обычных таблиц */
.tmapi-codes .tmapi-table {
    font-size: 14px;
}

.tmapi-codes .tmapi-table th,
.tmapi-codes .tmapi-table td {
    padding: 7px 14px;
}

.tmapi-codes code {
    font-weight: 600;
}

/* коды ошибок: колонка HTTP узкая */
.tmapi-errors .tmapi-table td:first-child,
.tmapi-errors .tmapi-table th:first-child {
    width: 70px;
    white-space: nowrap;
}

/* --- код ------------------------------------------------------------- */

.tmapi-code {
    margin: 0 0 16px;
    padding: 15px 18px;
    overflow-x: auto;
    border-radius: 11px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.6;
}

.tmapi-code code {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    white-space: pre;
}

.tmapi-code__label {
    display: block;
    margin-bottom: 8px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #7c93b3;
    white-space: normal;
}

/* код внутри текста и таблиц — светлый */
.tmapi p code,
.tmapi li code,
.tmapi-table code {
    padding: 2px 6px;
    border: 1px solid var(--tmapi-line);
    border-radius: 5px;
    background: var(--tmapi-soft);
    color: var(--tmapi-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .9em;
    white-space: nowrap;
}

/* --- выноски --------------------------------------------------------- */

.tmapi-note {
    margin: 0 0 14px;
    padding: 13px 17px;
    border-left: 3px solid var(--tmapi-accent);
    border-radius: 0 9px 9px 0;
    background: var(--tmapi-accent-soft);
    font-size: 15px;
    line-height: 1.55;
    color: #1e293b;
}

.tmapi-warn {
    border-left-color: #d97706;
    background: #fffbeb;
    color: #78350f;
}

.tmapi-note strong {
    color: inherit;
}

/* --- FAQ ------------------------------------------------------------- */

.tmapi-faq {
    margin: 0 0 8px;
    border: 1px solid var(--tmapi-line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.tmapi-faq details + details {
    border-top: 1px solid #eef2f7;
}

.tmapi-faq summary {
    padding: 14px 18px;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--tmapi-ink);
    cursor: pointer;
    list-style: none;
}

.tmapi-faq summary::-webkit-details-marker {
    display: none;
}

.tmapi-faq summary::after {
    content: "+";
    float: right;
    margin-left: 12px;
    color: var(--tmapi-accent);
    font-weight: 400;
    font-size: 19px;
    line-height: 1.1;
}

.tmapi-faq details[open] summary::after {
    content: "\2212";
}

.tmapi-faq summary:hover {
    background: var(--tmapi-soft);
}

.tmapi-faq .tmapi-faq__body {
    padding: 0 18px 15px;
}

.tmapi-faq p {
    margin: 0 0 10px;
    font-size: 15px;
}

.tmapi-faq p:last-child {
    margin-bottom: 0;
}

/* --- форма ----------------------------------------------------------- */

.tmapi-form-card {
    margin: 0 0 10px;
    padding: 26px 28px;
    border: 1px solid var(--tmapi-line);
    border-radius: 24px;
    background: var(--tmapi-soft);
    box-shadow: var(--tmfw-card-sh);
}

.tmapi .tmfw-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.tmapi-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
    margin: 0 0 22px;
}

.tmapi-mode {
    padding: 13px 16px;
    text-align: left;
    font: inherit;
    font-weight: 600;
    color: var(--tmapi-text);
    background: #fff;
    border: 1.5px solid #dbe3ec;
    border-radius: 11px;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}

.tmapi-mode span {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 400;
    color: var(--tmapi-mute);
}

.tmapi-mode:hover {
    border-color: #94a3b8;
}

.tmapi-mode.is-active {
    color: #1d4ed8;
    background: var(--tmapi-accent-soft);
    border-color: var(--tmapi-accent);
}

.tmapi-mode.is-active span {
    color: #3b6fd4;
}

/* Общие поля формы: раскладка для страницы API */
.tmapi .tmfw-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0 16px;
}

.tmapi-opt {
    font-weight: 400;
    font-size: 12.5px;
    color: #94a3b8;
}

/* Согласие и кнопка — одной строкой: подпись слева, действие в правом
   нижнем углу формы. Раньше кнопка стояла между двумя абзацами текста
   и читалась как часть текста, а не как завершение формы. */
.tmapi-submit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    margin: 20px 0 0;
}

.tmapi-accept {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1 1 320px;
    margin: 0;
    font-size: 14.5px;
    line-height: 1.5;
    color: #475569;
    cursor: pointer;
}

.tmapi-submit-row .tmfw-submit {
    flex: 0 0 auto;
}

@media (max-width: 560px) {
    .tmapi-submit-row .tmfw-submit {
        flex: 1 1 100%;
    }
}

.tmapi-accept input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--tmapi-accent);
    cursor: pointer;
}

.tmapi .tmfw-msg.is-error {
    padding: 12px 15px;
    border: 1px solid #fecaca;
    border-radius: 9px;
    background: #fef2f2;
    color: #b91c1c;
}

.tmapi .tmfw-msg.is-ok {
    padding: 14px 16px;
    border: 1px solid #bbf7d0;
    border-radius: 9px;
    background: #f0fdf4;
    color: #15803d;
    font-size: 15.5px;
}

.tmapi-contacts {
    margin: 14px 0 0;
    font-size: 15px;
    color: var(--tmapi-mute);
}

/* --- оферта: шапка документа ------------------------------------------ */

.tmapi-doc-head {
    margin: 0 0 18px;
    padding: 26px 30px;
    border: 1px solid var(--tmapi-line);
    border-radius: 30px;
    background: linear-gradient(135deg, #edf6ff 0%, #d9ecff 40%, #eaf7ff 70%, #f8fbff 100%);
    box-shadow: 0 16px 40px rgba(15, 91, 215, .08);
}

.tmapi-doc-head h1 {
    margin: 0 0 16px;
    font-size: clamp(22px, 2.7vw, 30px);
    line-height: 1.2;
    font-weight: 700;
    color: var(--tmapi-ink);
    letter-spacing: -.01em;
}

.tmapi-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tmapi-meta li {
    margin: 0;
    padding: 9px 13px;
    border: 1px solid #dde5f0;
    border-radius: 9px;
    background: rgba(255, 255, 255, .7);
    text-align: left;
}

.tmapi-meta span {
    display: block;
    font-size: 12px;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #8c9cb2;
}

.tmapi-meta b {
    display: block;
    margin-top: 2px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--tmapi-ink);
}

/* --- оферта: содержание ------------------------------------------------ */

.tmapi-toc {
    margin: 0 0 26px;
    padding: 18px 22px 14px;
    border: 1px solid var(--tmapi-line);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--tmfw-card-sh);
}

.tmapi-toc__title {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--tmapi-mute);
}

.tmapi-toc ol {
    margin: 0;
    padding-left: 22px;
}

.tmapi-toc li {
    margin: 0;
    padding: 5px 0;
    font-size: 15.5px;
    line-height: 1.4;
    color: var(--tmapi-mute);
}

.tmapi-toc li + li {
    border-top: 1px solid #f1f5f9;
}

.tmapi-toc a {
    color: var(--tmapi-accent);
    text-decoration: none;
}

.tmapi-toc a:visited {
    color: var(--tmapi-accent);
}

.tmapi-toc a:hover,
.tmapi-toc a:focus {
    color: #1d4ed8;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* --- оферта: разделы --------------------------------------------------- */

.tmapi-doc {
    margin: 0 0 16px;
    padding: 22px 28px 18px;
    border: 1px solid var(--tmapi-line);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--tmfw-card-sh);
    /* якорь не должен уезжать под залипающую шапку сайта */
    scroll-margin-top: 90px;
}

.tmapi-legal .tmapi-doc h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    font-size: clamp(18px, 1.9vw, 21px);
    line-height: 1.25;
}

.tmapi-doc__n {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 7px;
    border-radius: 9px;
    background: var(--tmapi-accent-soft);
    color: var(--tmapi-accent);
    font-size: 15px;
    font-weight: 700;
}

/* Пункт с висячим отступом: номер стоит слева, текст выровнен по себе,
   а не обтекает номер — так документ читается как договор, а не как проза */
.tmapi-cl {
    margin: 0 0 12px;
    padding-left: 3.1em;
    text-indent: -3.1em;
    font-size: 15.5px;
    line-height: 1.6;
}

.tmapi-cl b {
    display: inline-block;
    min-width: 2.6em;
    text-indent: 0;
    font-weight: 650;
    color: var(--tmapi-ink);
}

.tmapi-doc p:last-child,
.tmapi-doc ul:last-child,
.tmapi-doc dl:last-child {
    margin-bottom: 0;
}

/* --- оферта: определения ----------------------------------------------- */

.tmapi-terms {
    margin: 0;
}

.tmapi-terms dt {
    display: inline;
    font-weight: 650;
    color: var(--tmapi-ink);
}

.tmapi-terms dt::after {
    content: " — ";
    font-weight: 400;
    color: var(--tmapi-text);
}

.tmapi-terms dd {
    display: inline;
    margin: 0;
    font-size: 15.5px;
    line-height: 1.6;
}

.tmapi-terms dd::after {
    content: "";
    display: block;
    margin-bottom: 13px;
}

/* --- оферта: перечень запретов ----------------------------------------- */

.tmapi-banlist {
    margin: 0 0 12px;
    padding: 0 0 0 3.1em;
    list-style: none;
}

.tmapi-banlist li {
    position: relative;
    margin-bottom: 8px;
    padding-left: 18px;
    font-size: 15.5px;
    line-height: 1.6;
}

.tmapi-banlist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .62em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c3cfdf;
}

/* --- оферта: реквизиты -------------------------------------------------- */

.tmapi-doc--req .tmapi-scroll {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
}

.tmapi-req td:first-child {
    width: 34%;
    font-weight: 400;
    color: var(--tmapi-mute);
}

.tmapi-req td:last-child {
    font-weight: 500;
    color: var(--tmapi-ink);
}

.tmapi-req tr:hover td {
    background: transparent;
}

.tmapi-legal p {
    font-size: 15.5px;
}

/* --- блок FAQ плагина ------------------------------------------------- */

/*
   Элемент приходит с классами tmfaq-block и tmfaq-section--api, но БЕЗ
   базового tmfaq-section — поэтому правило padding: 24px 0 56px из
   tmfaq.css до него не достаёт, и блок остаётся вовсе без отступов:
   сверху к нему прилипает 48px от предыдущей секции, снизу он садится
   на подвал. Ровно по этой же причине для страницы виджетов правило
   написано отдельно в tm-free-widgets.css — здесь его зеркало.
*/
.tmfaq-block.tmfaq-section--api {
    padding-top: 0;
    padding-bottom: 56px;
    margin-top: -24px;
}

@media (max-width: 767px) {
    .tmfaq-block.tmfaq-section--api {
        padding-bottom: 40px;
        margin-top: -16px;
    }
}

/* --- узкие экраны ----------------------------------------------------- */

@media (max-width: 720px) {
    .tmapi-hero {
        padding: 22px 20px;
        border-radius: 24px;
    }

    .tmapi h2 {
        margin-top: 36px;
    }

    .tmapi-form-card {
        padding: 20px 17px;
    }

    .tmapi-table {
        font-size: 13.5px;
    }

    .tmapi-table th,
    .tmapi-table td {
        padding: 9px 11px;
    }

    .tmapi-code {
        padding: 12px 13px;
        font-size: 12px;
    }
}

/* --- хлебные крошки страниц API и юридических документов --------------- */

.tmapi .tmfw-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin: 0 0 18px;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--tmapi-mute);
}

.tmapi .tmfw-breadcrumb a {
    color: var(--tmapi-accent);
    text-decoration: none;
    transition: color .15s ease;
}

.tmapi .tmfw-breadcrumb a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.tmapi .tmfw-breadcrumb__sep {
    color: #94a3b8;
    user-select: none;
}

.tmapi .tmfw-breadcrumb > span:last-child {
    color: var(--tmapi-text);
}

@media (max-width: 720px) {
    .tmapi .tmfw-breadcrumb {
        gap: 5px;
        margin-bottom: 14px;
        font-size: 13px;
    }
}


/* ========================================================================
   Юридические документы — список материалов категории «Документы»
   ======================================================================== */

.tmapi-legal-index .tmapi-legal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0 10px;
}

.tmapi-legal-index .tmapi-legal-card {
    display: flex;
    flex-direction: column;
    min-height: 180px;
    padding: 24px 26px;
    border: 1px solid var(--tmapi-border);
    border-radius: 24px;
    background: #fff;
    color: var(--tmapi-text);
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .04);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.tmapi-legal-index .tmapi-legal-card:hover,
.tmapi-legal-index .tmapi-legal-card:focus {
    transform: translateY(-2px);
    border-color: var(--tmapi-accent);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
    text-decoration: none;
}

.tmapi-legal-index .tmapi-legal-card__type {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 14px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef6ff;
    color: var(--tmapi-accent);
    font-size: 12px;
    line-height: 1.4;
    font-weight: 700;
}

.tmapi-legal-index .tmapi-legal-card h2 {
    margin: 0 0 22px;
    color: var(--tmapi-text);
    font-size: 20px;
    line-height: 1.35;
}

.tmapi-legal-index .tmapi-legal-card:hover h2,
.tmapi-legal-index .tmapi-legal-card:focus h2 {
    color: var(--tmapi-accent);
}

.tmapi-legal-index .tmapi-legal-card__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    color: var(--tmapi-accent);
    font-size: 14px;
    font-weight: 700;
}

.tmapi-legal-index .tmapi-legal-pagination {
    margin-top: 28px;
}

@media (max-width: 720px) {
    .tmapi-legal-index .tmapi-legal-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .tmapi-legal-index .tmapi-legal-card {
        min-height: 150px;
        padding: 20px;
    }

    .tmapi-legal-index .tmapi-legal-card h2 {
        font-size: 18px;
    }
}

