/* Обучение: слой затемнения и копии серверных экранов. Цвета — токены sauda-ds. */

body.tut-on [data-spa-region="head"] { display: none; }

.tut-spot,
.tut-tip,
.tut-bar,
.tut-start-bg { font-family: var(--sd-font); }

/* z-index выше окон бутстрапа (1050) и нижней панели телефона (9991), иначе она закрывает подсказку */
.tut-spot { position: fixed; z-index: 10000; border-radius: var(--sd-r); box-shadow: 0 0 0 2px var(--sd-surface), 0 0 0 9999px rgba(14, 24, 34, .68); pointer-events: none; }

.tut-bar { position: fixed; z-index: 10002; top: 0; left: 0; right: 0; height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; background: var(--sd-ink); color: var(--sd-surface); font-size: 12.5px; font-weight: 500; }
.tut-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tut-bar button { flex: none; padding: 0; border: 0; background: none; color: var(--sd-surface); font-weight: 600; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tut-bar-r { flex: none; display: flex; align-items: center; gap: 16px; }

.tut-tip { position: fixed; z-index: 10001; width: 340px; padding: 16px; border-radius: var(--sd-r); background: var(--sd-surface); color: var(--sd-ink); font-size: 13.5px; line-height: 1.55; box-shadow: 0 16px 48px -8px rgba(0, 0, 0, .5); }
.tut-tip.is-nudge { box-shadow: 0 0 0 2px var(--sd-primary), 0 16px 48px -8px rgba(0, 0, 0, .5); }
.tut-tip-arrow { position: absolute; width: 12px; height: 12px; background: var(--sd-surface); transform: rotate(45deg); transition: opacity .12s ease; }
.tut-tip-ch { display: flex; justify-content: space-between; gap: 8px; color: var(--sd-ink-3); font-weight: 600; font-size: 11.5px; line-height: 16px; }
.tut-tip-bar { height: 3px; margin: 6px 0 10px; border-radius: 3px; background: var(--sd-muted-bg); }
.tut-tip-bar i { display: block; height: 100%; border-radius: 3px; background: var(--sd-primary); }
.tut-tip h3 { margin: 0; font-size: 15px; font-weight: 700; line-height: 21px; color: var(--sd-ink); }
.tut-tip p { margin: 4px 0 0; color: var(--sd-ink-2); }
.tut-tip-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.tut-do { color: var(--sd-primary); font-weight: 700; font-size: 12.5px; }
.tut-wait { color: var(--sd-ink-3); font-weight: 600; font-size: 12.5px; }
.tut-link { padding: 0; border: 0; background: none; color: var(--sd-ink-3); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.tut-link:hover { color: var(--sd-ink); }
.tut-more { display: block; margin-top: 6px; color: var(--sd-primary); }

.tut-stage { animation: sd-fade-in .22s ease; }

/* панель шагов: над затемнением, контент ужимается, а не закрывается */
.tut-panel { position: fixed; z-index: 10003; top: 38px; right: 0; bottom: 0; width: 320px; display: flex; flex-direction: column; background: var(--sd-surface); color: var(--sd-ink); font-family: var(--sd-font); font-size: 13px; line-height: 1.45; box-shadow: var(--sd-shadow-pop); transform: translateX(100%); visibility: hidden; transition: transform .26s ease, visibility 0s linear .26s; }
.tut-panel.is-open { transform: none; visibility: visible; transition: transform .26s ease; }
.tut-panel-scrim { display: none; }
.tut-panel-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--sd-hair); }
.tut-panel-h b { display: block; font-size: 14px; font-weight: 700; line-height: 20px; }
.tut-panel-h span { color: var(--sd-ink-3); font-size: 12px; font-weight: 500; }
.tut-panel-list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.tut-ch + .tut-ch { border-top: 1px solid var(--sd-hair); }
.tut-ch-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 8px; border: 0; background: none; color: var(--sd-ink-2); font-weight: 600; font-size: 13px; text-align: left; cursor: pointer; }
.tut-ch.is-current .tut-ch-h { color: var(--sd-primary); }
.tut-ch-h small { flex: none; color: var(--sd-ink-3); font-size: 12px; font-weight: 500; }
.tut-ch-body { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .24s ease, visibility 0s linear .24s; }
.tut-ch.is-open .tut-ch-body { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .24s ease; }
.tut-ch-steps { min-height: 0; overflow: hidden; margin: 0; padding: 0 0 6px; list-style: none; }
.tut-step { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--sd-r-sm); background: none; color: var(--sd-ink-3); font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; }
.tut-step:hover { background: var(--sd-hover); }
.tut-step-n { flex: none; width: 20px; color: var(--sd-ink-4); font-size: 12px; font-weight: 600; line-height: 19px; text-align: right; font-variant-numeric: tabular-nums; }
.tut-li.is-done .tut-step { color: var(--sd-ink-2); }
.tut-li.is-done .tut-step-n { color: var(--sd-success); }
.tut-li.is-now .tut-step { background: var(--sd-primary-50); color: var(--sd-primary); font-weight: 700; }
.tut-li.is-now .tut-step-n { color: var(--sd-primary); }
.tut-step-more { margin: 4px 8px 8px 36px; color: var(--sd-ink-2); font-size: 12.5px; line-height: 1.5; white-space: pre-line; animation: sd-fade-in .22s ease; }

@media (min-width: 1100px) {
    body.tut-on { transition: padding-right .26s ease; }
    body.tut-panel-open { padding-right: 320px; }
    body.tut-panel-open .modal { width: calc(100% - 320px); }
    body.tut-panel-open .tut-dlg-bg { right: 320px; }
}

/* уже панель выезжает снизу поверх всего */
@media (max-width: 1099px) {
    .tut-panel { top: auto; left: 0; width: auto; height: 72vh; border-radius: var(--sd-r) var(--sd-r) 0 0; transform: translateY(100%); }
    .tut-panel-scrim { display: block; position: fixed; z-index: 10002; inset: 38px 0 0 0; background: rgba(14, 24, 34, .35); }
}

.tut-start-bg { position: fixed; z-index: 10003; inset: 0; display: flex; padding: 16px; background: rgba(14, 24, 34, .68); overflow-y: auto; }
.tut-start { width: min(640px, 100%); margin: auto; padding: 24px; border-radius: var(--sd-r); background: var(--sd-surface); color: var(--sd-ink); font-size: 13.5px; line-height: 1.55; }
.tut-start h2 { margin: 0; font-size: 21px; font-weight: 800; line-height: 28px; letter-spacing: -.01em; text-wrap: balance; }
.tut-start > p { margin: 6px 0 0; color: var(--sd-ink-2); }
.tut-start h3 { margin: 16px 0 6px; color: var(--sd-ink-3); font-size: 12px; font-weight: 600; line-height: 16px; }
.tut-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tut-opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--sd-border); border-radius: var(--sd-r-sm); background: none; color: var(--sd-ink); font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.tut-opt.is-on { border-color: var(--sd-primary); background: var(--sd-primary-50); font-weight: 600; }
.tut-opt:disabled { color: var(--sd-ink-4); background: var(--sd-zebra); border-color: var(--sd-hair); cursor: default; }
.tut-opt small { font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.tut-begin { margin-top: 18px; }
.tut-mode { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; padding: 12px 14px; border-radius: var(--sd-r-sm); background: var(--sd-warn-bg); color: var(--sd-ink-2); }
.tut-mode b { color: var(--sd-ink); font-size: 14px; font-weight: 700; }
.tut-mode-end { margin: 14px 0 0; }
.tut-leave { display: inline-block; margin-top: 12px; font-weight: 600; font-size: 12.5px; }

.tut-search { margin-bottom: 6px; }
.tut-found { display: grid; gap: 4px; max-height: 188px; overflow-y: auto; margin-bottom: 8px; }
.tut-found-item { padding: 7px 10px; border: 1px solid var(--sd-hair); border-radius: var(--sd-r-sm); background: var(--sd-surface); color: var(--sd-ink); font-size: 12.5px; font-weight: 500; text-align: left; cursor: pointer; }
.tut-found-item:hover { background: var(--sd-hover); }
.tut-found-empty { margin-bottom: 8px; color: var(--sd-ink-3); font-size: 12.5px; }
.tut-picked { margin-bottom: 8px; padding: 8px 10px; border-radius: var(--sd-r-sm); background: var(--sd-primary-50); color: var(--sd-ink-2); font-size: 12.5px; }
.tut-picked b { color: var(--sd-ink); font-weight: 600; }

/* копии серверных экранов */
.tut-env-label { color: var(--sd-ink-3); font-size: 12.5px; margin-bottom: 4px; }
.tut-env-confirm { margin-top: 12px; color: var(--sd-ink-2); font-size: 13px; }
.tut-env-empty { margin-top: 10px; color: var(--sd-ink-3); font-size: 13px; }
.tut-env-sealed { padding: 12px 14px; border-radius: var(--sd-r-sm); background: var(--sd-zebra); }
.tut-env-sealed b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.tut-env-sealed code { font-size: 12px; color: var(--sd-ink-2); }

.tut-paper { max-width: 720px; margin: 0 auto; padding: 28px 36px; border: 1px solid var(--sd-hair); border-radius: var(--sd-r-sm); background: var(--sd-surface); color: var(--sd-ink); font-size: 13px; line-height: 1.7; }
.tut-paper h3 { margin: 0 0 14px; font-size: 14px; font-weight: 700; line-height: 20px; text-align: center; }
.tut-paper p { margin: 8px 0 0; }
.tut-paper-table { width: 100%; margin: 10px 0; border-collapse: collapse; font-size: 12.5px; }
.tut-paper-table th, .tut-paper-table td { padding: 6px 8px; border: 1px solid var(--sd-hair); font-weight: 500; }
.tut-paper-table th { color: var(--sd-ink-3); font-weight: 600; }

.tut-qr { width: 128px; height: 128px; display: flex; align-items: center; justify-content: center; padding: 12px; border: 1px dashed var(--sd-border); border-radius: var(--sd-r-sm); color: var(--sd-ink-3); font-weight: 600; font-size: 12px; text-align: center; }

.tut-jump { max-width: 460px; margin: 48px auto; padding: 28px; border-radius: var(--sd-r); background: var(--sd-surface); box-shadow: var(--sd-shadow); text-align: center; }
.tut-jump h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; line-height: 28px; }
.tut-jump p { margin: 0 0 16px; color: var(--sd-ink-2); }

.tut-dlg-bg { position: fixed; z-index: 1050; inset: 0; display: grid; place-items: center; padding: 16px; }
.tut-dlg { width: min(460px, 100%); border-radius: var(--sd-r); background: var(--sd-surface); color: var(--sd-ink); box-shadow: var(--sd-shadow-pop); }
.tut-dlg-h { padding: 14px 20px; border-bottom: 1px solid var(--sd-hair); font-size: 15px; font-weight: 700; line-height: 22px; }
.tut-dlg-b { padding: 16px 20px; }
.tut-dlg-note { color: var(--sd-ink-3); font-size: 12px; }
.tut-dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--sd-hair); }
.tut-cert { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--sd-border); border-radius: var(--sd-r-sm); background: var(--sd-surface); color: var(--sd-ink); text-align: left; cursor: pointer; }
.tut-cert.is-on { border-color: var(--sd-primary); background: var(--sd-primary-50); }
.tut-cert b { display: block; font-weight: 600; }
.tut-cert small { display: block; color: var(--sd-ink-3); font-size: 12px; }

@media (max-width: 560px) {
    .tut-opts { grid-template-columns: minmax(0, 1fr); }
    .tut-root { padding-bottom: 240px; }
    .tut-long { display: none; }
    .tut-paper { padding: 16px; }
    .tut-tip { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; }
    .tut-tip-arrow { display: none !important; }
    .tut-bar-r { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .tut-stage, .tut-step-more { animation: none; }
    .tut-panel, .tut-panel.is-open, .tut-ch-body, .tut-ch.is-open .tut-ch-body, body.tut-on { transition: none; }
}
