/* ZIP・フォルダ to Markdown：ページ固有のスタイル（共通の見た目は base.css・ui-kit.css・benri-kit.css） */
.ztm-hero { padding-bottom: 12px; }

.ztm-tool { padding: 8px 0 48px; --kit-shadow-card: 0 10px 30px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06); }
/* .alert などの display 指定より hidden 属性を優先する */
.ztm-tool [hidden] { display: none !important; }
.ztm-container { max-width: 980px; }

/* ---------- 入力 ---------- */
.ztm-drop { position: relative; border: 2px dashed rgba(0, 174, 239, .5); background: #f7fcff; }
.ztm-drop:hover { border-color: var(--primary-color); }
.ztm-drop.dragover { border-style: solid; border-color: var(--primary-color); background: #e9faff; }
.ztm-drop.upload-area-rich .upload-icon { width: 112px; }
.ztm-drop .ztm-drop-title { margin: 10px 0 0; font-size: 20px; font-weight: 800; color: var(--text-main); }
.ztm-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; }
.upload-area-rich .ztm-pick .btn { margin: 0; }
.ztm-drop .privacy-badge { max-width: 640px; line-height: 1.7; }
.ztm-sample-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 14px; text-align: center; }
.ztm-sample-row .ztm-note { flex-basis: 100%; }
.ztm-note { margin: 8px 0 0; color: var(--text-sub); font-size: 12.5px; line-height: 1.75; }

/* ---------- 進捗・通知 ---------- */
.ztm-progress { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 14px; margin-top: 18px; padding: 16px 18px; border-radius: 14px; background: #fff; box-shadow: var(--kit-shadow-card); }
.ztm-progress-text { display: flex; flex-direction: column; min-width: 0; }
.ztm-progress-text strong { font-size: 14px; }
.ztm-progress-text small { color: var(--text-sub); font-size: 12px; overflow-wrap: anywhere; }
.ztm-progress .btn i { margin-right: 4px; }
.ztm-bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: #e8eef3; overflow: hidden; }
.ztm-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary-color); transition: width .2s ease; }
.ztm-bar.is-indeterminate span { width: 35% !important; animation: ztm-slide 1.1s ease-in-out infinite; }
@keyframes ztm-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(310%); } }

.ztm-alert { margin-top: 14px; }
.alert.ztm-info { border-color: #bfe6f7; background: #eef9fe; color: #0b6a91; }
.ztm-inline-btn { margin-left: 10px; }
/* お知らせ枠の中の操作：ボタンではなく下線付きの文字リンクの見た目にする（要素は button のまま） */
.ztm-link-btn { padding: 0; border: 0; background: none; color: #0073a5; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ztm-link-btn:hover { color: #005a82; text-decoration-thickness: 2px; }
.ztm-link-btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 2px; }
.ztm-link-btn:disabled { color: var(--text-sub); cursor: default; }

/* ---------- 結果 ---------- */
.ztm-result, .ztm-prompt { margin-top: 22px; padding: 24px; border-radius: 16px; background: #fff; box-shadow: var(--kit-shadow-card); text-align: left; }
.ztm-result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.ztm-result-head h2 { flex: 1 1 240px; min-width: 0; margin: 0; font-size: 19px; line-height: 1.5; overflow-wrap: anywhere; }
.ztm-result-head .btn i { margin-right: 4px; }
.ztm-result.is-stale .status-pill { background: #eee; color: #666; }
.ztm-result.is-stale .status-pill::before { display: none; }

.ztm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; }
.ztm-stats div { padding: 12px 14px; border-radius: 12px; background: var(--bg-light); }
.ztm-stats dt { color: var(--text-sub); font-size: 12px; font-weight: 700; }
.ztm-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ztm-stats dd small { margin-left: 2px; color: var(--text-sub); font-size: 12px; font-weight: 700; }

.ztm-advice { margin: 12px 0 0; padding: 10px 14px; border-radius: 6px; background: #f5fbfe; font-size: 13px; line-height: 1.75; }
.ztm-advice.is-ok { background: #f1fbf7; }
.ztm-advice.is-warn { background: #fff8ee; }
.ztm-advice.is-alert { background: #fff5f5; }
.ztm-advice:empty { display: none; }
.ztm-advice-actions { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; margin-left: 10px; }

/* 固定ヘッダーの下に来るようにスクロールする（結果・タブ・プロンプトへの移動） */
.ztm-result, .ztm-prompt, .ztm-tabs { scroll-margin-top: 92px; }
.ztm-next { margin: 14px 0 0; font-size: 13px; font-weight: 700; }
.ztm-next a { display: inline-flex; align-items: center; gap: 6px; color: var(--primary-color); text-decoration: none; }
.ztm-next a:hover, .ztm-next a:focus-visible { text-decoration: underline; }
.ztm-prompt h2:focus { outline: none; }

.ztm-modes { margin: 20px 0 14px; }
.ztm-modes .mode-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; }
.ztm-modes .mode-tab i { font-size: 16px; margin-bottom: 2px; }
.ztm-modes .mode-tab small { font-size: 11px; font-weight: 700; color: var(--text-sub); }
.ztm-modes .mode-tab[aria-pressed=true] small { color: var(--primary-color); }

.ztm-panel-actions { margin-top: 4px; }
.ztm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.ztm-actions .btn i { margin-right: 6px; }
.ztm-actions .btn:disabled i { opacity: .6; }
.ztm-fmt-row { justify-content: center; }
.ztm-fmt-more { display: flex; }
.ztm-fmt-more > summary { display: block; list-style: none; font-family: inherit; font-size: .8333rem; font-weight: 700; line-height: normal; user-select: none; }
.ztm-fmt-more > summary::-webkit-details-marker { display: none; }
.ztm-fmt-icon { transition: transform .2s ease; }
.ztm-fmt-more[open] .ztm-fmt-icon { transform: rotate(180deg); }
.ztm-fmt-more.is-off > summary { opacity: .6; pointer-events: none; }

.ztm-inline-fields { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.ztm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ztm-field > span { font-size: 13px; font-weight: 700; color: var(--text-main); }
.ztm-select, .ztm-search, .ztm-textarea { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--input-border); border-radius: 10px; background: #fff; color: var(--text-main); font: inherit; font-size: 14px; }
.ztm-select { padding-right: 32px; }
.ztm-select:focus, .ztm-search:focus, .ztm-textarea:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 3px var(--input-focus-ring); }
.ztm-textarea { min-height: 96px; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 13px; line-height: 1.6; resize: vertical; }

.ztm-file-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.ztm-file-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid #e6edf2; border-radius: 12px; background: #fbfdfe; }
.ztm-file-list .ztm-fname { flex: 1 1 240px; min-width: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.ztm-file-list .ztm-fmeta { display: block; color: var(--text-sub); font-size: 12px; font-weight: 400; }
.ztm-file-list .btn { padding: 8px 14px; }
.ztm-file-list .btn i { margin-right: 4px; }
.ztm-file-list .btn.is-done { border-color: #38b28a; color: #2a8a6a; }
.ztm-file-list li.is-over { border-color: #fbd38d; background: #fffaf0; }
.ztm-file-list li.is-next { border-color: #8fd3ef; background: #f5fbfe; }
.ztm-chunks { counter-reset: none; }

/* ---------- タブ ---------- */
.ztm-tabs { display: flex; gap: 4px; margin-top: 24px; border-bottom: 2px solid #e8eef3; overflow-x: auto; }
.ztm-tab { flex: 0 0 auto; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; background: none; color: var(--text-sub); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ztm-tab[aria-selected=true] { border-bottom-color: var(--primary-color); color: var(--primary-color); }
.ztm-tab:hover { color: var(--primary-color); }
.ztm-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #edf2f6; color: var(--text-sub); font-size: 11px; line-height: 18px; text-align: center; }
.ztm-count:empty { display: none; }
.ztm-count.is-alert { background: #fdecc8; color: #a85b00; }
.ztm-tabpanel { padding-top: 14px; }

/* ---------- ファイル一覧（ツリー） ---------- */
.ztm-tree-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ztm-tree-tools .ztm-search { flex: 1 1 240px; width: auto; }
.ztm-tree-tools .btn i { margin-right: 4px; }
.ztm-tree-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: 13px; }
.ztm-filter { display: inline-flex; align-items: center; gap: 6px; }
.ztm-filter > span { color: var(--text-sub); font-weight: 700; white-space: nowrap; }
.ztm-filter .ztm-select { width: auto; min-height: 36px; padding: 4px 10px; font-size: 13px; }
.ztm-tree-bulk { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.ztm-tree-bulk .ztm-note { margin: 0; }
.ztm-path-panel { margin-top: 10px; padding: 14px; border: 1px solid #e6edf2; border-radius: 12px; background: #fbfdfe; }
.ztm-path-panel .ztm-actions { margin-top: 10px; }
.ztm-path-panel .btn i { margin-right: 4px; }
.ztm-path-panel #pathResult:empty { display: none; }
.ztm-tree { max-height: 520px; margin-top: 10px; padding: 6px 0; overflow: auto; border: 1px solid #e6edf2; border-radius: 12px; background: #fff; font-size: 13px; }
.ztm-row { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 10px 3px calc(10px + var(--lv, 0) * 18px); border-bottom: 1px solid #f3f6f8; }
.ztm-row:last-child { border-bottom: 0; }
.ztm-row:hover { background: #f7fbfd; }
.ztm-twisty { flex: 0 0 22px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-sub); cursor: pointer; }
.ztm-twisty:hover { background: #eaf3f8; }
.ztm-twisty i { transition: transform .15s ease; }
.ztm-row[aria-expanded=true] .ztm-twisty i { transform: rotate(90deg); }
.ztm-twisty-space { flex: 0 0 22px; }
.ztm-row input[type=checkbox] { flex: 0 0 auto; width: 16px; height: 16px; margin: 0 2px; accent-color: var(--primary-color); cursor: pointer; }
.ztm-row input[type=checkbox]:disabled { cursor: not-allowed; }
.ztm-row .ztm-ico { flex: 0 0 16px; color: #7c8b96; text-align: center; }
.ztm-row .ztm-ico.is-dir { color: #e2a52b; }
.ztm-row .ztm-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ztm-row .ztm-meta { flex: 0 0 auto; color: var(--text-sub); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ztm-row.is-off .ztm-name { color: #8a959e; }
.ztm-row.is-locked .ztm-name { color: #a7b0b7; }
.ztm-tag { flex: 0 0 auto; padding: 1px 7px; border-radius: 999px; background: #eef2f5; color: #5d6b75; font-size: 11px; font-weight: 700; white-space: nowrap; }
.ztm-tag.is-in { background: #e6f7fd; color: #0b78a5; }
.ztm-tag-btn { border: 0; font-family: inherit; line-height: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ztm-tag-btn:hover { background: #d3f0fb; }
.ztm-tag-btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.ztm-tag.is-enc { background: #f0ecff; color: #5b47b0; }
.ztm-tag.is-warn { background: #fff1d6; color: #9a5b00; }
.ztm-tag.is-danger { background: #ffe8e8; color: #b42318; }
.ztm-tree-empty { padding: 18px; color: var(--text-sub); text-align: center; }
.ztm-more { padding: 10px 14px; color: var(--text-sub); font-size: 12px; }

/* ---------- プレビュー・プロンプト ---------- */
.ztm-pre { max-height: 440px; margin: 10px 0 0; padding: 14px 16px; overflow: auto; border: 1px solid #e6edf2; border-radius: 12px; background: #f7f9fb; color: #24313a; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 12.5px; line-height: 1.6; white-space: pre; tab-size: 4; }
.ztm-preview-pick { max-width: 520px; }

/* ---------- 除外・警告 ---------- */
.ztm-warn-group { margin: 0 0 22px; }
.ztm-warn-group:last-child { margin-bottom: 0; }
.ztm-warn-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 15px; }
.ztm-warn-group h3 i { color: var(--primary-color); }
.ztm-warn-group.is-danger h3 i { color: #d64545; }
.ztm-warn-group.is-warn h3 i { color: #e0952b; }
.ztm-warn-group > p { margin: 0 0 10px; color: var(--text-sub); font-size: 12.5px; line-height: 1.75; }
.ztm-warn-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ztm-warn-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border: 1px solid #edf1f4; border-radius: 10px; background: #fbfcfd; font-size: 13px; }
.ztm-warn-path { flex: 1 1 260px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.ztm-warn-detail { flex-basis: 100%; color: var(--text-sub); font-size: 12px; line-height: 1.6; }
.ztm-warn-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ztm-warn-actions .btn { padding: 6px 12px; font-size: 12.5px; }
.ztm-warn-actions .btn.is-confirm { border-color: #e5484d; background: #fff5f5; color: #c53030; }
.ztm-warn-actions .ztm-select { width: auto; min-height: 36px; padding: 4px 30px 4px 10px; font-size: 13px; }
.ztm-warn-summary { margin: 0; padding-left: 1.2em; color: var(--text-sub); font-size: 13px; line-height: 1.9; }

/* ---------- 詳細設定 ---------- */
.ztm-settings { margin-top: 22px; border: 1px solid #e6edf2; border-radius: 14px; background: #fbfdfe; }
.ztm-settings > summary { display: flex; align-items: center; gap: 8px; padding: 14px 18px; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.ztm-settings > summary::-webkit-details-marker { display: none; }
.ztm-settings > summary::after { content: ""; width: 10px; height: 10px; margin-left: auto; border-right: 2px solid #777; border-bottom: 2px solid #777; transform: rotate(45deg); transition: transform .2s ease; }
.ztm-settings[open] > summary::after { transform: rotate(225deg); }
.ztm-settings > summary i { color: var(--primary-color); }
.ztm-settings-body { padding: 4px 18px 18px; }
.ztm-settings-lead { margin: 0 0 14px; }
.ztm-settings-lead i { color: var(--primary-color); }
.ztm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.ztm-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; margin-top: 14px; }
.ztm-toggles .toggle-row small { display: block; color: var(--text-sub); font-size: 11.5px; line-height: 1.6; }
.ztm-glob { margin-top: 14px; }
.ztm-mask { margin: 16px 0 0; padding: 12px 14px 4px; border: 1px solid #e6edf2; border-radius: 12px; }
.ztm-mask legend { padding: 0 6px; font-size: 14px; font-weight: 700; }
.ztm-mask .ztm-toggles { margin-top: 0; }
.ztm-mask .ztm-field { margin-top: 10px; }

/* ---------- プロンプト ---------- */
.ztm-prompt h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 19px; }
.ztm-prompt h2 i { color: var(--primary-color); }
.ztm-mini-steps { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0 0; padding: 0; list-style: none; counter-reset: ztm-step; font-size: 13px; }
.ztm-mini-steps li { counter-increment: ztm-step; display: flex; align-items: center; gap: 6px; }
.ztm-mini-steps li::before { content: counter(ztm-step); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-yellow); font-size: 12px; font-weight: 800; }
.ztm-card-steps { margin: 8px 0; padding-left: 1.4em; font-size: 14px; line-height: 1.7; }
.ztm-card-steps li + li { margin-top: 2px; }
.ztm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ztm-chip { min-height: 38px; padding: 7px 14px; border: 2px solid #e5eaee; border-radius: 999px; background: #fff; color: var(--text-main); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: transform .2s ease, border-color .2s ease, background-color .2s ease, color .2s ease; }
.ztm-chip:hover { border-color: var(--primary-color); }
.ztm-chip[aria-pressed=true] { border-color: var(--primary-color); background: var(--primary-color); color: #fff; }
.ztm-prompt-text { max-height: 320px; white-space: pre-wrap; font-family: inherit; font-size: 13.5px; line-height: 1.8; }

/* ---------- 解説 ---------- */
.ztm-sample-out { max-height: none; font-size: 12px; }
.ztm-facts .bk-list li { font-size: 14px; }

/* ---------- トースト ---------- */
.ztm-toast { position: fixed; left: 50%; bottom: 15%; z-index: 1000; width: max-content; max-width: min(calc(100% - 32px), 720px); padding: 15px 27px; border-radius: 14px; background: rgba(33, 41, 48, .92); color: #fff; font-size: 19.5px; font-weight: 700; line-height: 1.5; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.ztm-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
    .ztm-result, .ztm-prompt { padding: 18px 14px; }
    .ztm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ztm-stats dd { font-size: 17px; }
    .ztm-grid, .ztm-toggles { grid-template-columns: 1fr; }
    .ztm-modes .mode-tab { font-size: 12px; }
    .ztm-modes .mode-tab small { display: none; }
    .ztm-row .ztm-meta { display: none; }
    .ztm-progress { grid-template-columns: auto 1fr; }
    .ztm-progress .btn { grid-column: 1 / -1; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
    .ztm-bar span, .ztm-twisty i, .ztm-chip, .ztm-toast { transition: none; }
    .ztm-bar.is-indeterminate span { animation: none; }
}
