/*
 * MADO SCENARIO TREE CSS SSOT CLEAN BUILD 2026-07-11.
 * Provider only: public/css/scenario-tree-page.css.
 * Duplicate selectors, dead selectors, dated patch labels, and obsolete purple CSV controls were removed.
 * Chat preview width and height use the canonical customer chat-design values.
 *
 * COMPACT CHAT PREVIEW CONTRACT / 狭幅チャットプレビュー契約（2026-08-03）:
 * - 1260px以下のプレビューは固定表示を維持するが、stickyツールバーの下から開始する。
 * - 実際のツールバー下端はscenario-tree-editor.jsが
 *   --mado-scenario-tree-preview-safe-topへ1か所だけ公開する。
 * - ツールバーはz-index:80、プレビューはz-index:70とし、プレビュー表示中も
 *   「チャットを閉じる」「設定を保存」など上部操作をクリックできる状態を保つ。
 * - top:16px / z-index:220へ戻すとツールバーを覆うため、新しい呼び出し元で復活させない。
 *
 * RECOVERY NOTE / 復元メモ（2026-08-03）:
 * - 誤ってscenario-tree-page.cssとして渡されたsupport-staff用CSSとは統合しない。
 * - 本ファイルはシナリオ画面の最終正常アーカイブを基準に復元した正本である。
 */

html.mado-scenario-tree-active-root,
body.mado-scenario-tree-active {
    --mado-scenario-tree-surface-bg: #3f3f3f;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
}

body.mado-portal-standalone--scenario-tree .mado-portal-shell.mado-portal-shell--action-scenario-tree,
body.mado-portal-standalone--scenario-tree .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content,
body.mado-portal-standalone--scenario-tree .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content > .mado-portal-shell__content-frame,
body .mado-portal-container.mado-scenario-tree-page,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
    --mado-scenario-tree-surface-bg: #3f3f3f;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
}

body.mado-portal-standalone--scenario-tree .mado-portal-shell.mado-portal-shell--action-scenario-tree,
body.mado-portal-standalone--scenario-tree .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content,
body.mado-portal-standalone--scenario-tree .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content > .mado-portal-shell__content-frame {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
    box-shadow: none;
    overflow: visible;
}

body .mado-portal-shell.mado-portal-shell--action-scenario-tree,
body .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content,
body .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content > .mado-portal-shell__content-frame {
    --mado-scenario-tree-surface-bg: #3f3f3f;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
    border: 0;
    box-shadow: none;
}

body .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content,
body .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content > .mado-portal-shell__content-frame {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
    overflow: visible;
}

body .mado-portal-shell.mado-portal-shell--action-scenario-tree > .mado-portal-shell__content > .mado-portal-shell__content-frame.is-standard {
    width: 100%;
    max-width: none;
}

body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) #masthead,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .inside-header {
    display: none;
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}

body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .site-content,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) #content,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) #primary,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) #main,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .content-area,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .inside-article,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .entry-content,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .woocommerce,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .woocommerce-MyAccount-content,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .mado-portal-shell,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .mado-portal-shell__content,
body.mado-scenario-tree-active:not(.mado-portal-standalone--scenario-tree) .mado-portal-shell__content-frame {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
    box-shadow: none;
    overflow: visible;
}

body .mado-portal-shell.mado-portal-shell--action-scenario-tree {
    column-gap: clamp(20px, 2.2vw, 32px);
    row-gap: 0;
}

body .mado-portal-shell.mado-portal-shell--action-scenario-tree[data-mado-portal-nav-v2-state="collapsed"] {
    column-gap: 0;
}

body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page,
body .mado-portal-container.mado-scenario-tree-page {
    --mado-scenario-tree-page-gutter: clamp(12px, 1.4vw, 18px);
    --mado-scenario-tree-page-padding: 0 var(--mado-scenario-tree-page-gutter) 18px;
    --mado-scenario-tree-shell-gap: 16px;
    --mado-scenario-preview-window-width: 384px;
    --mado-scenario-preview-window-height: 600px;
    --mado-scenario-tree-sidebar-width: var(--mado-scenario-preview-window-width, 384px);
    --mado-scenario-tree-board-pad-top: 12px;
    --mado-scenario-tree-board-pad-right: 0px;
    --mado-scenario-tree-board-pad-bottom: 20px;
    --mado-scenario-tree-board-pad-left: 96px;
    --mado-scenario-tree-sticky-gap: 0px;
    --mado-scenario-tree-admin-offset: 0px;
    --mado-scenario-tree-topbar-height: 0px;
    --mado-scenario-tree-preview-safe-top: 16px;
    --mado-scenario-tree-sticky-top: calc(var(--mado-scenario-tree-admin-offset) + var(--mado-scenario-tree-sticky-gap));
    --mado-scenario-tree-sidebar-measured-width: 0px;
    --mado-scenario-tree-board-wrap-width: 100%;
    --mado-scenario-tree-board-wrap-max-width: 100%;
    --mado-scenario-tree-board-wrap-margin-right: 0px;
    --mado-scenario-tree-board-wrap-min-height: 64vh;
    --mado-scenario-preview-window-background: linear-gradient(161deg, rgba(144, 249, 247, 1) 0%, rgba(225, 250, 254, 1) 100%);
    --mado-scenario-preview-window-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --mado-scenario-preview-header-bg: rgba(144, 249, 247, 1);
    --mado-scenario-preview-body-bg: rgba(170, 245, 242, 1);
    --mado-scenario-preview-composer-bg: rgba(255, 255, 255, 1);
    --mado-scenario-preview-title-color: #ca8c8c;
    --mado-scenario-preview-title-size: 18px;
    --mado-scenario-preview-subtitle-color: #b54545;
    --mado-scenario-preview-subtitle-size: 14px;
    --mado-scenario-preview-header-offset-x: 38px;
    --mado-scenario-preview-message-font-size: 14px;
    --mado-scenario-preview-chip-font-size: 14px;
    --mado-scenario-preview-input-font-size: 14px;
    --mado-scenario-preview-assistant-bg: #ffffff;
    --mado-scenario-preview-assistant-text: #0f172a;
    --mado-scenario-preview-assistant-border: #ffffff;
    --mado-scenario-preview-assistant-border-width: 1px;
    --mado-scenario-preview-assistant-shadow: none;
    --mado-scenario-preview-user-bg: #12b5cb;
    --mado-scenario-preview-user-text: #ffffff;
    --mado-scenario-preview-user-border: #ffffff;
    --mado-scenario-preview-user-border-width: 1px;
    --mado-scenario-preview-user-shadow: none;
    --mado-scenario-preview-chip-bg: #84f1e9;
    --mado-scenario-preview-chip-text: #334155;
    --mado-scenario-preview-chip-border: #ffffff;
    --mado-scenario-preview-chip-border-width: 1px;
    --mado-scenario-preview-chip-active-bg: #4eefe4;
    --mado-scenario-preview-chip-active-text: #ffffff;
    --mado-scenario-preview-chip-active-border: #ffffff;
    --mado-scenario-preview-chip-active-border-width: 1px;
    --mado-scenario-preview-link-bg: #ffffff;
    --mado-scenario-preview-link-text: #1f2937;
    --mado-scenario-preview-link-border: #0f172a;
    --mado-scenario-preview-link-font-size: 14px;
    --mado-scenario-preview-input-bg: #ffffff;
    --mado-scenario-preview-input-text: #111111;
    --mado-scenario-preview-input-border: #e5e7eb;
    --mado-scenario-preview-input-border-width: 1px;
    --mado-scenario-preview-send-bg: #4eefe4;
    --mado-scenario-preview-send-color: #ffffff;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: var(--mado-scenario-tree-page-padding);
    box-sizing: border-box;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
    color: #ffffff;
    overflow: visible;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-form,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-shell,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-workspace {
    overflow: visible;
}

body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-shell,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--mado-scenario-tree-sidebar-width, 320px);
    gap: var(--mado-scenario-tree-shell-gap, 16px);
    align-items: start;
    width: 100%;
    min-width: 0;
    position: relative;
    overflow: visible;
}

body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-workspace,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-workspace {
    grid-column: 1 / 2;
    grid-row: 1;
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 8px;
    flex: 1 1 auto;
    justify-self: stretch;
    z-index: 1;
    overflow: visible;
}

body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-sidebar,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-sidebar {
    grid-column: 2 / 3;
    grid-row: 1;
    display: grid;
    gap: 18px;
    box-sizing: border-box;
    width: var(--mado-scenario-tree-sidebar-width, 418px);
    min-width: var(--mado-scenario-tree-sidebar-width, 418px);
    max-width: var(--mado-scenario-tree-sidebar-width, 418px);
    margin-left: auto;
    position: sticky;
    top: calc(var(--mado-scenario-tree-sticky-top, 0px) + var(--mado-scenario-tree-topbar-height, 0px) + 16px);
    right: var(--mado-scenario-tree-page-gutter, 0px);
    justify-self: end;
    align-self: start;
    z-index: 45;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar,
body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
    display: grid;
    grid-template-columns:
        minmax(250px, 1.55fr)
        minmax(120px, 1fr)
        minmax(145px, 1.1fr)
        minmax(125px, 1fr)
        minmax(145px, 1.1fr)
        minmax(120px, 1fr)
        minmax(175px, 1.25fr);
    align-items: center;
    gap: 0;
    position: sticky;
    top: var(--mado-scenario-tree-sticky-top, 0px);
    z-index: 80;
    min-height: 58px;
    margin: 0 0 16px;
    padding: 0 18px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0;
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
    color: #ffffff;
    backdrop-filter: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main {
    display: contents;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-copy {
    grid-column: 1;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 34px;
    width: 100%;
    color: #ffffff;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-switch .mado-ui-switch-visual {
    transform: scale(1);
    transform-origin: left center;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-text {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.018em;
    white-space: nowrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-heading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: 0.018em;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-heading:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__title:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 4px;
    border-radius: 4px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-current,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-stat,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link:visited,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save {
    font-weight: 700;
    letter-spacing: 0.018em;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-current {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-icon,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-current {
    color: #ffffff;
    fill: currentColor;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-icon--custom {
    display: inline-flex;
    width: 24px;
    height: 24px;
    min-width: 24px;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-icon--custom svg,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip {
    color: #0f7a5a;
    background: #ecfff6;
    border-color: #8ce2ba;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin-left: 2px;
    padding: 0;
    border-radius: 999px;
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    cursor: pointer;
    pointer-events: auto;
    overflow: visible;
    vertical-align: middle;
    text-decoration: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip::before,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip::after {
    box-shadow: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip .mado-site-qa__help-chip-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #72c79c;
    background: #e8fbf1;
    color: #15803d;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(21, 128, 61, 0.12);
    pointer-events: none;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip:hover .mado-site-qa__help-chip-mark,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip:focus-visible .mado-site-qa__help-chip-mark,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip.is-open .mado-site-qa__help-chip-mark {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(21, 128, 61, 0.22);
    transform: translateY(-1px);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip:focus-visible {
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__help-chip:focus-visible .mado-site-qa__help-chip-mark {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

body .mado-help-chip-popover {
    position: fixed;
    z-index: 100002;
    width: min(520px, calc(100vw - 48px));
    min-width: 360px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #d6e1e4;
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.18);
    font-family: "Noto Sans JP", "Noto Sans", sans-serif;
    font-size: 14px;
    line-height: 1.85;
    text-align: left;
    word-break: break-word;
    pointer-events: auto;
}

body .mado-help-chip-popover__title {
    margin-bottom: 8px;
    font-weight: 700;
    color: #111827;
}

body .mado-help-chip-popover__line + .mado-help-chip-popover__line {
    margin-top: 4px;
}

body .mado-help-chip-popover__line strong {
    font-weight: 800;
    color: #0f172a;
}

body .mado-help-chip-popover__arrow {
    position: fixed;
    z-index: 100001;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    pointer-events: none;
}

body .mado-help-chip-popover__arrow.is-below {
    border-bottom: 8px solid #ffffff;
}

body .mado-help-chip-popover__arrow.is-above {
    border-top: 8px solid #ffffff;
}

@media (max-width: 520px) {
    body .mado-help-chip-popover {
        min-width: 0;
        width: calc(100vw - 24px);
        padding: 12px 14px;
    }
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta {
    grid-column: 7;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.38);
    box-sizing: border-box;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-stat {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 12px;
    white-space: nowrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu {
    display: contents;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle {
    grid-column: 2;
    grid-row: 1;
}

body .mado-portal-container.mado-scenario-tree-page #mado-scenario-tree-bulk-toggle {
    grid-column: 3;
    grid-row: 1;
}

body .mado-portal-container.mado-scenario-tree-page [data-scenario-scroll-target="mado-scenario-tree-common-settings"] {
    grid-column: 4;
    grid-row: 1;
}

body .mado-portal-container.mado-scenario-tree-page #mado-scenario-tree-preview-toggle {
    grid-column: 5;
    grid-row: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save {
    grid-column: 6;
    grid-row: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link:visited,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    white-space: nowrap;
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.018em;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    white-space: nowrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save {
    width: 100%;
    min-width: 0;
    padding-inline: 12px;
    flex: 0 0 auto;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 7px;
    flex: 0 0 18px;
    background: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M160 144C151.2 144 144 151.2 144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 237.3C496 233.1 494.3 229 491.3 226L416 150.6L416 240C416 257.7 401.7 272 384 272L224 272C206.3 272 192 257.7 192 240L192 144L160 144zM240 144L240 224L368 224L368 144L240 144zM96 160C96 124.7 124.7 96 160 96L402.7 96C419.7 96 436 102.7 448 114.7L525.3 192C537.3 204 544 220.3 544 237.3L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM256 384C256 348.7 284.7 320 320 320C355.3 320 384 348.7 384 384C384 419.3 355.3 448 320 448C284.7 448 256 419.3 256 384z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M160 144C151.2 144 144 151.2 144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 237.3C496 233.1 494.3 229 491.3 226L416 150.6L416 240C416 257.7 401.7 272 384 272L224 272C206.3 272 192 257.7 192 240L192 144L160 144zM240 144L240 224L368 224L368 144L240 144zM96 160C96 124.7 124.7 96 160 96L402.7 96C419.7 96 436 102.7 448 114.7L525.3 192C537.3 204 544 220.3 544 237.3L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM256 384C256 348.7 284.7 320 320 320C355.3 320 384 348.7 384 384C384 419.3 355.3 448 320 448C284.7 448 256 419.3 256 384z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon {
    display: inline-flex;
    width: 23px;
    height: 23px;
    min-width: 23px;
    flex: 0 0 23px;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    color: #ffffff;
    line-height: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon--common {
    width: 24px;
    height: 24px;
    min-width: 24px;
    flex-basis: 24px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon--common svg,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon--common svg path {
    fill: #ffffff;
    color: #ffffff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-label,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    line-height: 1;
    text-align: center;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button.is-active {
    background: rgba(255, 255, 255, 0.14);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button--preview[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.12);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 0;
    background: rgba(63, 63, 63, 0.94);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-flash[hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-flash__message {
    min-width: 0;
    color: #ffffff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-flash__close {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel {
    --mado-scenario-csv-download: #18c7a0;
    --mado-scenario-csv-download-hover: #10a987;
    --mado-scenario-csv-action: #0798a7;
    --mado-scenario-csv-action-hover: #087682;
    --mado-scenario-csv-control-border: #cbd5e1;
    --mado-scenario-csv-control-radius: 12px;
    --mado-scenario-csv-control-height: 42px;
    width: min(960px, calc(100% - 32px));
    margin: 16px auto 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel[hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel .mado-scenario-accordion-header {
    background: #f8fafc;
    border-bottom: 1px solid #dce4ed;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel .mado-scenario-accordion-icon svg {
    fill: currentColor;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-settings {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin: 0 0 18px;
    margin-left: 100px;
    margin-right: 100px;
    max-width: calc(100% - 200px);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-settings[hidden] {
    display: none;
    margin: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card {
    display: grid;
    gap: 14px;
    align-content: start;
    padding: 18px;
    border: 1px solid #dce3eb;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

body .mado-portal-container.mado-scenario-tree-page #mado-scenario-tree-common-prompt {
    margin-top: 14px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__title {
    margin: 0;
    color: #0f172a;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.4;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__text {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.7;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__field {
    display: grid;
    gap: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__field > span,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__label {
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card textarea,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card input[type="text"],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card input[type="url"] {
    width: 100%;
    border: 1px solid #d0dae4;
    border-radius: 14px;
    background: #ffffff;
    color: #0f172a;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card textarea {
    min-height: 88px;
    resize: vertical;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card textarea:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card input[type="text"]:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card input[type="url"]:focus {
    border-color: #0ea5e9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap {
    position: relative;
    width: var(--mado-scenario-tree-board-wrap-width, 100%);
    min-width: 0;
    max-width: var(--mado-scenario-tree-board-wrap-max-width, 100%);
    min-height: max(var(--mado-scenario-tree-board-wrap-min-height, 64vh), calc(100vh - var(--mado-scenario-tree-sticky-top) - 126px));
    margin-left: 0;
    margin-right: var(--mado-scenario-tree-board-wrap-margin-right, 0px);
    padding: var(--mado-scenario-tree-board-pad-top) var(--mado-scenario-tree-board-pad-right) var(--mado-scenario-tree-board-pad-bottom) var(--mado-scenario-tree-board-pad-left);
    border: 0;
    border-radius: 0;
    overflow: visible;
    overscroll-behavior-x: auto;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px) 0 0 / 48px 48px,
        linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px) 0 0 / 48px 48px,
        #3f3f3f;
    box-shadow: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-hint {
    position: absolute;
    top: 52px;
    left: 18px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: calc(100% - 36px);
    pointer-events: none;
    color: rgba(226, 232, 240, 0.74);
    font-size: 12px;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.38);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board {
    position: relative;
    min-width: 100%;
    isolation: isolate;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__columns,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__svg,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__nodes {
    position: absolute;
    inset: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__columns {
    z-index: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__column {
    position: absolute;
    top: 12px;
    width: 272px;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__root-add {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__svg {
    z-index: 2;
    overflow: visible;
    pointer-events: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__path {
    fill: none;
    stroke: rgba(203, 213, 225, 0.78);
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.95;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board__nodes {
    z-index: 3;
    border-radius: 0;
}

body .mado-portal-container.mado-scenario-tree-page.is-space-pan-ready .mado-scenario-tree-board-wrap,
body .mado-portal-container.mado-scenario-tree-page.is-space-pan-ready .mado-scenario-tree-board,
body .mado-portal-container.mado-scenario-tree-page.is-space-pan-ready .mado-scenario-tree-board__nodes,
body .mado-portal-container.mado-scenario-tree-page.is-space-pan-ready .mado-scenario-tree-board__svg {
    cursor: grab;
}

body .mado-portal-container.mado-scenario-tree-page.is-space-panning .mado-scenario-tree-board-wrap,
body .mado-portal-container.mado-scenario-tree-page.is-space-panning .mado-scenario-tree-board,
body .mado-portal-container.mado-scenario-tree-page.is-space-panning .mado-scenario-tree-board__nodes,
body .mado-portal-container.mado-scenario-tree-page.is-space-panning .mado-scenario-tree-board__svg {
    cursor: grabbing;
    user-select: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node {
    position: absolute;
    width: 272px;
    min-height: 132px;
    padding: 12px 16px 16px;
    border-radius: 20px;
    border: 1px solid #c6d1dc;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node:hover {
    border-color: #93a5b8;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node.is-selected {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16), 0 18px 34px rgba(15, 23, 42, 0.12);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__depth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__top-actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__add-wrap {
    position: relative;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__icon:hover {
    background: #e8eef5;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__icon:focus-visible {
    background: #e8eef5;
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__icon--add {
    font-size: 24px;
    font-weight: 800;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__icon--delete {
    color: #dc2626;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__add-menu {
    min-width: 194px;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 12;
    display: grid;
    gap: 6px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid #d7dee7;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__add-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__add-option:hover {
    background: #e2e8f0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__add-option:focus-visible {
    background: #e2e8f0;
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__add-option[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__body {
    display: grid;
    gap: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__label {
    display: block;
    width: 100%;
    min-height: 54px;
    height: 54px;
    padding: 10px 12px;
    border: 1px solid #d0dae4;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    resize: none;
    overflow: hidden;
    cursor: text;
    outline: none;
    box-sizing: border-box;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__label:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__label.is-empty {
    color: #94a3b8;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__summary {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__edit {
    position: absolute;
    right: 12px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d7dee7;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.10);
    cursor: pointer;
    font-size: 0;
    transition: background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__edit-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: #334155;
    fill: currentColor;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__edit-icon > path {
    fill: currentColor;
    stroke: none;
    opacity: 1;
    visibility: visible;
}

body .mado-portal-container.mado-scenario-tree-page button.mado-scenario-tree-node__edit::before,
body .mado-portal-container.mado-scenario-tree-page button.mado-scenario-tree-node__edit::after {
    display: none;
    content: none;
}

body .mado-portal-container.mado-scenario-tree-page button.mado-scenario-tree-node__edit {
    border: 1px solid #d7dee7;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
}

body .mado-portal-container.mado-scenario-tree-page button.mado-scenario-tree-node__edit > svg.mado-scenario-tree-node__edit-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: currentColor;
    fill: currentColor;
    opacity: 1;
    visibility: visible;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__edit:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-node__edit:focus-visible {
    border-color: #c5d0dc;
    background: #f8fafc;
    color: #0f172a;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
    transform: translateY(-1px);
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel {
    padding: 16px;
    border-radius: 24px;
    border: 1px solid #dce3eb;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__device {
    display: flex;
    flex-direction: column;
    width: var(--mado-scenario-preview-window-width, 384px);
    max-width: 100%;
    height: var(--mado-scenario-preview-window-height, 600px);
    min-height: 0;
    margin: 0 auto;
    border-radius: 28px;
    border: 1px solid #c8d6e5;
    background: var(--mado-scenario-preview-window-background);
    box-shadow: var(--mado-scenario-preview-window-shadow);
    overflow: hidden;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 18px 16px 14px;
    background: var(--mado-scenario-preview-header-bg);
    color: var(--mado-scenario-preview-subtitle-color);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__header > div {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
    text-align: left;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__header strong {
    display: block;
    margin-bottom: 4px;
    color: var(--mado-scenario-preview-title-color);
    font-size: var(--mado-scenario-preview-title-size);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__header > div span {
    color: var(--mado-scenario-preview-subtitle-color);
    font-size: var(--mado-scenario-preview-subtitle-size);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__close {
    appearance: none;
    display: inline-grid;
    place-items: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__close:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__close:focus-visible {
    border-color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.22);
    outline: 3px solid #38bdf8;
    outline-offset: 2px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: auto;
    padding: 18px 14px 14px;
    background: var(--mado-scenario-preview-body-bg);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message {
    display: flex;
    margin: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.is-user,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.ai-chat-message-user {
    justify-content: flex-end;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-content {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--mado-scenario-preview-assistant-bg);
    color: var(--mado-scenario-preview-assistant-text);
    border: var(--mado-scenario-preview-assistant-border-width) solid var(--mado-scenario-preview-assistant-border);
    font-size: var(--mado-scenario-preview-message-font-size);
    line-height: 1.6;
    box-shadow: var(--mado-scenario-preview-assistant-shadow);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.is-user .mado-scenario-tree-preview__message-content,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.ai-chat-message-user .mado-scenario-tree-preview__message-content {
    background: var(--mado-scenario-preview-user-bg);
    color: var(--mado-scenario-preview-user-text);
    border-color: var(--mado-scenario-preview-user-border);
    border-width: var(--mado-scenario-preview-user-border-width);
    box-shadow: var(--mado-scenario-preview-user-shadow);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-content.is-soft,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message[data-entry-refs-level] .mado-scenario-tree-preview__message-content {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: inherit;
    max-width: 100%;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message[data-entry-chips-level] .mado-scenario-tree-preview__message-text {
    margin-bottom: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-time {
    display: block;
    margin-top: 4px;
    color: rgba(100, 116, 139, 0.88);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.is-user .mado-scenario-tree-preview__message-time,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.ai-chat-message-user .mado-scenario-tree-preview__message-time {
    color: rgba(71, 85, 105, 0.82);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-content strong {
    font-weight: 800;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-content a,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__ref {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    max-width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--mado-scenario-preview-link-border);
    border-radius: 999px;
    background: var(--mado-scenario-preview-link-bg);
    color: var(--mado-scenario-preview-link-text);
    font-size: var(--mado-scenario-preview-link-font-size);
    font-weight: 700;
    text-decoration: none;
    vertical-align: baseline;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message-content a::after,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__ref::after {
    content: "↗";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
    font-size: 0.82em;
    line-height: 1;
    color: currentColor;
    opacity: 0.86;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__ref.is-static::after {
    content: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__message.is-user .mado-scenario-tree-preview__message-content a {
    color: var(--mado-scenario-preview-link-text);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__image,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__inline-image,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__image img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__chips,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__refs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: var(--mado-scenario-preview-chip-border-width) solid var(--mado-scenario-preview-chip-border);
    border-radius: 999px;
    background: var(--mado-scenario-preview-chip-bg);
    color: var(--mado-scenario-preview-chip-text);
    font-size: var(--mado-scenario-preview-chip-font-size);
    font-weight: 400;
    line-height: 1.4;
    cursor: default;
    pointer-events: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-preview__chip.is-active {
    border-color: var(--mado-scenario-preview-chip-active-border);
    border-width: var(--mado-scenario-preview-chip-active-border-width);
    background: var(--mado-scenario-preview-chip-active-bg);
    color: var(--mado-scenario-preview-chip-active-text);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__composer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    background: var(--mado-scenario-preview-composer-bg);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__composer span {
    display: flex;
    align-items: center;
    min-height: 42px;
    flex: 1 1 auto;
    padding: 0 14px;
    border: var(--mado-scenario-preview-input-border-width) solid var(--mado-scenario-preview-input-border);
    border-radius: 999px;
    background: var(--mado-scenario-preview-input-bg);
    color: var(--mado-scenario-preview-input-text);
    font-size: var(--mado-scenario-preview-input-font-size);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__composer button {
    display: inline-grid;
    place-items: center;
    position: relative;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    margin: 0;
    flex: 0 0 42px;
    border: 0;
    border-radius: 999px;
    background: var(--mado-scenario-preview-send-bg);
    color: var(--mado-scenario-preview-send-color);
    font-size: 0;
    line-height: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-phone__composer button::before {
    content: "";
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    background-color: var(--mado-scenario-preview-send-color);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='17' y2='12'/%3E%3Cpolyline points='12 7 17 12 12 17'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='17' y2='12'/%3E%3Cpolyline points='12 7 17 12 12 17'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel {
    display: grid;
    gap: 16px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__section {
    display: grid;
    gap: 10px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__empty {
    padding: 18px;
    border-radius: 16px;
    background: #f8fafc;
    color: #64748b;
    line-height: 1.7;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__detail {
    display: grid;
    gap: 14px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__detail-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__path {
    font-weight: 700;
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__depth {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel .mado-ui-input,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel .mado-ui-textarea,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel input[type="text"],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel input[type="url"],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel textarea {
    width: 100%;
    border: 1px solid #d0dae4;
    border-radius: 14px;
    background: #ffffff;
    color: #0f172a;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel textarea {
    min-height: 104px;
    resize: vertical;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel input[type="text"]:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel input[type="url"]:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel textarea:focus {
    border-color: #0ea5e9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__hint {
    margin: -2px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__refs-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__refs-list {
    display: grid;
    gap: 10px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__refs-empty {
    margin: 0;
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    color: #64748b;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__ref-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) auto;
    gap: 10px;
    align-items: center;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__ref-remove {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-form__footer {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal[hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.54);
    backdrop-filter: blur(3px);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal__dialog {
    position: relative;
    width: min(100% - 32px, 420px);
    margin: 14vh auto 0;
    padding: 22px;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal__dialog:focus {
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal__dialog h3 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 20px;
    font-weight: 700;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal__dialog p {
    margin: 0;
    color: #475569;
    line-height: 1.7;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover[hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover [hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-group[hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field[hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-group[hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__linkbox[hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel [hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover,
body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board > .mado-scenario-tree-editor-popover {
    position: absolute;
    z-index: 30;
    width: min(700px, calc(100vw - 32px));
    max-width: min(700px, calc(100vw - 32px));
    min-width: min(300px, calc(100vw - 32px));
    box-sizing: border-box;
    pointer-events: auto;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head.is-dragging {
    cursor: grabbing;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head button,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head input,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head textarea,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head select,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head a {
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__heading {
    display: grid;
    gap: 4px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__title {
    color: #0f172a;
    font-size: 17px;
    font-weight: 800;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__path {
    color: #64748b;
    font-size: 11px;
    line-height: 1.5;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__close,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__tool {
    border: 0;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    cursor: pointer;
    font-weight: 700;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 0;
    line-height: 1;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__close::before {
    content: "×";
    display: block;
    font-size: 20px;
    line-height: 1;
    transform: translateY(-1px);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__save,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__tool {
    min-height: 34px;
    padding: 0 12px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__save.is-applied {
    border-color: #0f9f86;
    background: #0f9f86;
    color: #ffffff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-group,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-group {
    display: grid;
    gap: 10px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover .mado-ui-input,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover .mado-ui-textarea,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field textarea,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field select,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__linkbox input {
    width: 100%;
    border: 1px solid #d0dae4;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    padding: 9px 11px;
    font-size: 14px;
    line-height: 1.6;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field textarea {
    resize: vertical;
    min-height: 58px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field--label textarea {
    min-height: 42px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field textarea:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field select:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__linkbox input:focus {
    border-color: #0ea5e9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__linkbox {
    display: grid;
    gap: 6px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save.is-saving,
body .mado-portal-container.mado-scenario-tree-page [data-scenario-tree-save-button].is-saving {
    pointer-events: none;
    opacity: 0.88;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save.is-saving::before,
body .mado-portal-container.mado-scenario-tree-page [data-scenario-tree-save-button].is-saving::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    background: transparent;
    -webkit-mask-image: none;
    mask-image: none;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: mado-scenario-save-spin 0.8s linear infinite;
    flex: 0 0 14px;
}

@keyframes mado-scenario-save-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1300px) {
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "main"
            "menu";
        align-items: start;
        min-height: auto;
        padding: 8px 12px 8px 16px;
        gap: 6px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main {
        grid-area: main;
        display: grid;
        grid-template-columns: max-content minmax(12px, 1fr) auto;
        grid-template-areas: "copy . meta";
        align-items: center;
        gap: 10px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-copy,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-copy {
        grid-area: copy;
        grid-column: auto;
        grid-row: auto;
        min-width: 0;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta {
        grid-area: meta;
        grid-column: auto;
        grid-row: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        min-width: 0;
        margin-left: 0;
        width: auto;
        gap: 8px;
        padding: 0;
        border-left: 0;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu {
        grid-area: menu;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: stretch;
        justify-content: stretch;
        row-gap: 0;
        column-gap: 0;
        width: 100%;
        margin-left: 0;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle,
    body .mado-portal-container.mado-scenario-tree-page #mado-scenario-tree-bulk-toggle,
    body .mado-portal-container.mado-scenario-tree-page [data-scenario-scroll-target="mado-scenario-tree-common-settings"],
    body .mado-portal-container.mado-scenario-tree-page #mado-scenario-tree-preview-toggle,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save {
        grid-column: auto;
        grid-row: auto;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-text {
        display: inline-flex;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-switch {
        gap: 8px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-tooltip {
        top: calc(100% + 8px);
        right: auto;
        left: 0;
        transform: translateY(-4px);
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle:hover .mado-scenario-tree-page__entry-toggle-tooltip,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle:focus-within .mado-scenario-tree-page__entry-toggle-tooltip {
        transform: translateY(0);
    }
}

@media (max-width: 1260px) {
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page,
    body .mado-portal-container.mado-scenario-tree-page {
        --mado-scenario-tree-page-gutter: 12px;
        --mado-scenario-tree-board-pad-left: 72px;
        --mado-scenario-tree-board-wrap-width: 100%;
        --mado-scenario-tree-board-wrap-max-width: 100%;
        --mado-scenario-tree-board-wrap-margin-right: 0px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-shell,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-workspace,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-workspace {
        grid-column: 1 / -1;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-sidebar,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-sidebar {
        display: none;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page.is-preview-open .mado-scenario-tree-sidebar,
    body .mado-portal-container.mado-scenario-tree-page.is-preview-open .mado-scenario-tree-sidebar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        position: fixed;
        top: max(var(--mado-scenario-tree-preview-safe-top, 16px), env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
        box-sizing: border-box;
        width: min(var(--mado-scenario-preview-window-width, 384px), calc(100vw - 32px));
        min-width: 0;
        max-width: calc(100vw - 32px);
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: auto;
        overscroll-behavior: contain;
        justify-self: auto;
        align-self: auto;
        z-index: 70;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "main"
            "menu";
        align-items: start;
        min-height: auto;
        padding: 8px 12px 8px 16px;
        gap: 6px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main {
        grid-area: main;
        display: grid;
        grid-template-columns: max-content minmax(12px, 1fr) auto;
        grid-template-areas: "copy . meta";
        align-items: center;
        gap: 10px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-copy,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-copy {
        grid-area: copy;
        min-width: 0;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta {
        grid-area: meta;
        justify-content: flex-end;
        flex-wrap: nowrap;
        min-width: 0;
        margin-left: 0;
        width: auto;
        gap: 8px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu {
        grid-area: menu;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: stretch;
        justify-content: stretch;
        row-gap: 0;
        column-gap: 0;
        width: 100%;
        margin-left: 0;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle {
        min-width: 0;
        width: 100%;
        min-height: 34px;
        padding: 4px 10px;
        border: 0;
        border-left: 1px solid rgba(255, 255, 255, 0.38);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        white-space: nowrap;
        text-align: center;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu > :first-child,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu > :first-child {
        border-left: 0;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon {
        width: 19px;
        height: 19px;
        min-width: 19px;
        flex-basis: 19px;
        margin-right: 6px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel {
        width: calc(100% - 24px);
        margin-top: 12px;
    }


    body .mado-portal-container.mado-scenario-tree-page.is-preview-open .mado-scenario-tree-phone__device {
        width: var(--mado-scenario-preview-window-width, 384px);
        max-width: 100%;
        height: var(--mado-scenario-preview-window-height, 600px);
        min-height: 0;
    }
}

@media (max-width: 960px) {
    body .mado-portal-container.mado-scenario-tree-page {
        --mado-scenario-tree-board-pad-left: 28px;
        --mado-scenario-tree-page-padding: 8px 12px 14px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-card__grid {
        grid-template-columns: 1fr;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
        position: static;
        width: auto;
        max-width: none;
        align-items: start;
        padding: 15px 10px 8px 14px;
        gap: 6px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main {
        grid-template-columns: max-content minmax(12px, 1fr) auto;
        grid-template-areas: "copy . meta";
        gap: 8px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__crumb-heading {
        flex-wrap: nowrap;
        gap: 6px;
        white-space: nowrap;
        font-size: 13px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta {
        justify-content: flex-end;
        width: auto;
        gap: 6px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-stat,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-stat {
        min-height: 30px;
        padding: 0 8px;
        font-size: 12px;
        line-height: 1.15;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-switch .mado-ui-switch-visual {
        transform: scale(1);
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-tooltip {
        width: min(280px, calc(100vw - 28px));
        font-size: 11px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle {
        min-height: 34px;
        padding: 4px 8px;
        font-size: 13px;
        line-height: 1.2;
        white-space: nowrap;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-common-settings {
        margin-left: 0;
        margin-right: 0;
        max-width: none;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap {
        padding: 12px 12px 18px var(--mado-scenario-tree-board-pad-left);
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-panel__ref-row {
        grid-template-columns: 1fr;
    }
}

.mado-portal-shell[data-sidebar-start-mode="mobile"] .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main,
.mado-portal-shell[data-mado-portal-nav-v2-mode="mobile"] .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main {
    padding-left: 44px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__panel {
    position: relative;
    display: grid;
    width: 100%;
    box-sizing: border-box;
    max-height: var(--mado-editor-panel-max-height, calc(100vh - 32px));
    padding: 16px 16px 18px;
    overflow: auto;
    border: 1px solid #d7dee7;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
    gap: 14px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 10px 12px 14px;
    border: 1px solid #d7e3f0;
    border-radius: 16px;
    background: #f8fbff;
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode legend {
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    margin: 0 0 2px;
    padding: 0 6px;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
    white-space: normal;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    margin: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #d7e3f0;
    border-radius: 16px;
    background: #ffffff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card.is-active {
    border-color: #22c8e5;
    background: #f0fbff;
    box-shadow: 0 0 0 2px rgba(34, 200, 229, 0.08);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-option {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 38px;
    width: 100%;
    margin: 0;
    padding: 7px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #0f172a;
    line-height: 1.5;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-option input[type="radio"] {
    flex: 0 0 auto;
    margin: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-option span {
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.55;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-body {
    display: grid;
    gap: 12px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-body--answer {
    padding-top: 12px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card:not(.is-active) .mado-scenario-tree-editor-popover__step-mode-body--answer {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-group,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-group {
    padding: 12px;
    border: 1px solid #d7e3f0;
    border-radius: 16px;
    background: #f8fbff;
    margin: 0;
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-group,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-group,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-body--answer > .mado-scenario-tree-editor-popover__answer-group + .mado-scenario-tree-editor-popover__link-group {
    margin-top: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field {
    display: grid;
    gap: 7px;
    margin: 0;
    color: #334155;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field > span,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-title {
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.55;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-title {
    margin: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-help-chip {
    flex: 0 0 auto;
    vertical-align: middle;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-state {
    display: grid;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin-top: 2px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-state[hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-preview {
    display: grid;
    min-height: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-item {
    position: relative;
    min-width: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-zoom {
    display: block;
    width: 100%;
    min-height: 132px;
    height: 100%;
    padding: 8px;
    border: 1px solid #d7e3f0;
    border-radius: 14px;
    background: #ffffff;
    cursor: zoom-in;
    text-align: center;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-zoom:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-zoom:focus-visible {
    border-color: #22c8e5;
    box-shadow: 0 0 0 3px rgba(34, 200, 229, 0.12);
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-zoom img,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-preview img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 168px;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
    object-fit: contain;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-status {
    min-width: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-remove,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-remove.mado-inquiry-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border: 1px solid rgba(220, 38, 38, 0.32);
    border-radius: 999px;
    background: #fff1f2;
    color: #dc2626;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.16);
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-remove:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-remove:focus-visible {
    background: #fee2e2;
    border-color: rgba(220, 38, 38, 0.48);
    color: #b91c1c;
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14), 0 10px 22px rgba(220, 38, 38, 0.16);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-remove .mado-inquiry-action-icon {
    display: block;
    width: 17px;
    height: 17px;
    fill: currentColor;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-item .mado-scenario-tree-editor-popover__image-remove {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover * {
    box-sizing: border-box;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__panel,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-group,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-group {
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card.is-active,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card:has(input[type="radio"]:checked) {
    border-color: #22c8e5;
    background: #f0fbff;
    box-shadow: 0 0 0 2px rgba(34, 200, 229, 0.12);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card.is-active .mado-scenario-tree-editor-popover__step-mode-option,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card:has(input[type="radio"]:checked) .mado-scenario-tree-editor-popover__step-mode-option {
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card.is-active .mado-scenario-tree-editor-popover__step-mode-option span,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-card:has(input[type="radio"]:checked) .mado-scenario-tree-editor-popover__step-mode-option span {
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode legend,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field > span,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__link-title,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__hint {
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__hint {
    margin: -2px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
    font-weight: 500;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-tools > .mado-scenario-tree-editor-popover__tool,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-tools .mado-scenario-tree-editor-popover__image-action-row > .mado-scenario-tree-editor-popover__tool {
    width: 100%;
    min-width: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

@media (max-width: 720px) {
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-tools,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__linkbox,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-shell__content:has(.mado-scenario-tree-page),
body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-shell__content-frame:has(.mado-scenario-tree-page),
body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page {
    background: var(--mado-scenario-tree-surface-bg, #3f3f3f);
    border: 0;
    outline: 0;
    box-shadow: none;
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-shell__content:has(.mado-scenario-tree-page) {
    overflow-x: visible;
    overflow-y: visible;
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.28);
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap::-webkit-scrollbar-thumb {
    background: rgba(226, 232, 240, 0.72);
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 42, 0.28);
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap::-webkit-scrollbar-corner {
    background: rgba(15, 23, 42, 0.28);
}

/* Keep the scenario map close to the collapsed sidebar without changing other portal pages. */

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page {
    --mado-scenario-tree-page-gutter: 0px;
    --mado-scenario-tree-page-padding: 0 0 18px;
}

/* Reduce the extra blank band between the sticky toolbar and the map board. */

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
    margin-bottom: 8px;
}

/* Keep horizontal board scrolling, but do not trap normal vertical wheel scrolling inside the board. */

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap {
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-color: rgba(226, 232, 240, 0.7) rgba(15, 23, 42, 0.28);
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    margin-left: 0;
}

/* Tighten only the scenario map frame. Other portal pages keep their gutters. */

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page,
body .mado-portal-container.mado-scenario-tree-page {
    --mado-scenario-tree-page-gutter: 0px;
    --mado-scenario-tree-page-padding: 0 0 18px;
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar {
    padding-left: 8px;
    padding-right: 8px;
    margin-bottom: 6px;
}

body.mado-portal-account-page .mado-portal-shell.mado-portal-shell--action-scenario-tree .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-board-wrap {
    padding-top: 8px;
}

/* Depth columns no longer show separate floating badges; node cards keep their own depth markers. */

/* Scenario-chip control lives in the first toolbar slot; tooltip remains attached to the switch. */

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-tooltip {
    position: absolute;
    z-index: 100003;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.28);
    color: #f8fafc;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform-origin: top left;
    transition: opacity 0.08s ease, visibility 0.08s ease, transform 0.08s ease;
    top: calc(100% + 8px);
    right: auto;
    left: 0;
    width: 240px;
    max-width: min(240px, calc(100vw - 40px));
    padding: 8px 10px;
    white-space: normal;
    overflow-wrap: normal;
    word-break: keep-all;
    text-align: left;
    line-height: 1.45;
    transform: translateY(-2px);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle:hover .mado-scenario-tree-page__entry-toggle-tooltip,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle:focus-within .mado-scenario-tree-page__entry-toggle-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 640px) {
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-main {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "copy meta";
        row-gap: 8px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-meta {
        justify-content: flex-end;
        width: auto;
        gap: 4px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-stat {
        padding: 0 7px;
        font-size: 11px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__topbar-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-top: 4px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save,
    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-link,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-button,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-toggle {
        min-height: 32px;
        padding: 4px 6px;
        font-size: 13px;
    }

    body.mado-scenario-tree-active .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-icon {
        width: 17px;
        height: 17px;
        min-width: 17px;
        flex-basis: 17px;
        margin-right: 5px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle-tooltip {
        top: calc(100% + 8px);
        right: auto;
        left: 0;
        width: min(220px, calc(100vw - 24px));
        max-width: min(220px, calc(100vw - 24px));
        transform: translateY(4px);
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle:hover .mado-scenario-tree-page__entry-toggle-tooltip,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__entry-toggle:focus-within .mado-scenario-tree-page__entry-toggle-tooltip {
        transform: translateY(0);
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-page__toolbar-save {
        grid-column: 1 / -1;
    }
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover select.mado-ui-select,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field select.mado-ui-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75L6 6.25l4.5-4.5' fill='none' stroke='%2364748b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px 8px;
    padding-right: 44px;
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover select.mado-ui-select:focus,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__field select.mado-ui-select:focus {
    border-color: #22c8e5;
    box-shadow: 0 0 0 3px rgba(34, 200, 229, 0.12);
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__image-meta .mado-scenario-tree-editor-popover__image-remove:not([data-editor-image-remove-kind]) {
    display: none;
}

.mado-scenario-tree-editor-image-delete-modal[hidden] {
    display: none;
}

.mado-scenario-tree-editor-image-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 100080;
    display: grid;
    place-items: center;
    padding: 24px;
    font-family: var(--ai-chat-font-family, "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif);
}

.mado-scenario-tree-editor-image-delete-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
}

.mado-scenario-tree-editor-image-delete-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100vw - 48px));
    padding: 22px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 18px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.mado-scenario-tree-editor-image-delete-modal__title {
    margin: 0;
    font-size: 17px;
    line-height: 1.5;
    font-weight: 800;
}

.mado-scenario-tree-editor-image-delete-modal__description {
    margin: 10px 0 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.7;
}

.mado-scenario-tree-editor-image-delete-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.mado-scenario-tree-editor-image-delete-modal .mado-ui-button--danger {
    border-color: #ef4444;
    background: #dc2626;
    color: #ffffff;
}

.mado-scenario-tree-editor-image-delete-modal .mado-ui-button--danger:hover,
.mado-scenario-tree-editor-image-delete-modal .mado-ui-button--danger:focus-visible {
    border-color: #b91c1c;
    background: #b91c1c;
    color: #ffffff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel .mado-scenario-accordion-body {
    padding: 20px;
    background: #f2f3f4;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel .mado-scenario-card__description {
    margin: 0 0 16px;
    color: #334155;
    font-size: 13px;
    line-height: 1.65;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "template current upload" "file file import";
    align-items: center;
    row-gap: 18px;
    column-gap: 0;
    width: 100%;
    min-width: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    min-height: 58px;
    margin: 0;
    padding: 10px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    background-image: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
    position: relative;
    transform: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action::before {
    content: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--current::before,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--upload::before {
    content: "";
    position: absolute;
    top: 25%;
    bottom: 25%;
    left: 0;
    width: 2px;
    background: var(--mado-scenario-csv-action);
    opacity: 0.72;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action:focus-visible {
    background: rgba(7, 152, 167, 0.07);
    box-shadow: none;
    transform: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--template {
    grid-area: template;
    color: var(--mado-scenario-csv-download);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--current {
    grid-area: current;
    color: var(--mado-scenario-csv-download);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--upload {
    grid-area: upload;
    color: var(--mado-scenario-csv-action);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--upload:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--upload:focus-visible {
    background: rgba(7, 152, 167, 0.07);
    color: var(--mado-scenario-csv-action-hover);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--template:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--template:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--current:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--current:focus-visible {
    color: var(--mado-scenario-csv-download-hover);
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action__icon {
    display: block;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    fill: currentColor;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-file-control {
    grid-area: file;
    display: grid;
    grid-template-columns: 250px minmax(0, 320px);
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-width: 0;
    padding: 0 16px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-file-trigger {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 250px;
    min-width: 250px;
    min-height: var(--mado-scenario-csv-control-height);
    margin: 0;
    padding: 9px 18px;
    border: 1.5px solid var(--mado-scenario-csv-action);
    border-radius: 999px;
    background: #ffffff;
    background-image: none;
    color: var(--mado-scenario-csv-action);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
    transform: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-file-trigger:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-file-trigger:focus-visible {
    border-color: var(--mado-scenario-csv-action-hover);
    background: #eefbfd;
    color: var(--mado-scenario-csv-action-hover);
    box-shadow: none;
    transform: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-upload-name {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 320px;
    min-width: 0;
    min-height: var(--mado-scenario-csv-control-height);
    padding: 8px 12px;
    border: 1px solid var(--mado-scenario-csv-control-border);
    border-radius: var(--mado-scenario-csv-control-radius);
    background: #ffffff;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-upload-name.is-empty {
    color: #6b7280;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-import-button {
    grid-area: import;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    gap: 10px;
    width: 250px;
    min-width: 250px;
    min-height: var(--mado-scenario-csv-control-height);
    margin: 0;
    padding: 9px 18px;
    border: 1.5px solid var(--mado-scenario-csv-action);
    border-radius: 999px;
    background: #ffffff;
    background-image: none;
    color: var(--mado-scenario-csv-action);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-shadow: none;
    box-shadow: none;
    cursor: pointer;
    transform: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-import-button:hover,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-import-button:focus-visible {
    border-color: var(--mado-scenario-csv-action-hover);
    background: #eefbfd;
    color: var(--mado-scenario-csv-action-hover);
    box-shadow: none;
    transform: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel > .mado-scenario-accordion-header .mado-design-accordion-chevron {
    font-size: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-bulk-panel > .mado-scenario-accordion-header .mado-design-accordion-chevron::before {
    content: "+";
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

@media (max-width: 760px) {
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "template"
            "current"
            "upload"
            "file"
            "import";
        row-gap: 10px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-file-control {
        grid-template-columns: minmax(0, 1fr);
        padding: 0;
        gap: 10px;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-import-button {
        margin: 0;
        width: 100%;
        min-width: 0;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-file-trigger {
        width: 100%;
        min-width: 0;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-upload-name {
        max-width: none;
    }

    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--current::before,
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-csv-action--upload::before {
        top: 0;
        bottom: auto;
        left: 25%;
        width: 50%;
        height: 1px;
    }
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__panel[aria-modal="true"] {
    overscroll-behavior: contain;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__panel[aria-modal="true"]:focus {
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__close:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__save:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__tool:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover .mado-site-qa__help-chip:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover input:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover select:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover textarea:focus-visible,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover a:focus-visible {
    outline: 3px solid #0ea5e9;
    outline-offset: 3px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-option:has(input[type="radio"]:focus-visible) {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
    background: #e6f9fd;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__step-mode-option input[type="radio"]:focus-visible {
    outline: none;
}

body .mado-portal-container.mado-scenario-tree-page.is-preview-hidden .mado-scenario-tree-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

body .mado-portal-container.mado-scenario-tree-page.is-preview-hidden .mado-scenario-tree-workspace {
    grid-column: 1 / -1;
}

body .mado-portal-container.mado-scenario-tree-page.is-preview-hidden .mado-scenario-tree-sidebar,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-sidebar[aria-hidden="true"] {
    display: none;
}

/*
 * SCENARIO Q&A REFERENCE UI / シナリオ→Q&A参照（2026-08-07）
 * - Q&A本文はここへ複製せず、Q&A IDだけを入力する。
 * - 公開時はQ&A質問を既存entry-chipデザインで表示する。
 * - 削除条件: scenario editorの回答元UIを別の正式schemaへ移行した時にJS/PHP/helperと同時に削除する。
 */
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-group[hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source[hidden],
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-preview[hidden] {
    display: none;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source,
body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-group {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
    margin: 8px 0 0;
    padding: 12px;
    border: 1px solid #d7e3f0;
    border-radius: 16px;
    background: #f8fbff;
    color: #0f172a;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source legend {
    padding: 0 6px;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 9px 10px;
    border: 1px solid #d7e3f0;
    border-radius: 12px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source-option:has(input:checked) {
    border-color: #22c8e5;
    background: #eefcff;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source-option input[type="radio"] {
    flex: 0 0 auto;
    margin: 0;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source-option span {
    min-width: 0;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-ids {
    min-height: 72px;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid #cfe4ec;
    border-radius: 999px;
    background: #ffffff;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.45;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-preview-chip.is-missing {
    border-color: #f3b7b7;
    background: #fff7f7;
    color: #991b1b;
}

body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__qa-preview-id {
    flex: 0 0 auto;
    font-weight: 800;
    color: #0f766e;
}

@media (max-width: 640px) {
    body .mado-portal-container.mado-scenario-tree-page .mado-scenario-tree-editor-popover__answer-source-options {
        grid-template-columns: 1fr;
    }
}
