:root {
  --bg: #f6f7f9; --panel: #fff; --text: #111418; --muted: #3f4654; --line: #c4cad5;
  --brand: #2554d6; --brand-ink: #fff; --link: #1d4ed8; --link-hover: #1e3a8a; --danger: #c0392b; --ok: #157347; --warn: #8a5a0b;
  --add-bg: #e6f6ec; --add-ink: #14532d; --del-bg: #fde8e8; --del-ink: #7f1d1d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --panel: #1b2029; --text: #f3f5f9; --muted: #c5ccd8; --line: #414a5c;
    --brand: #6b94ff; --brand-ink: #0b1020; --link: #9cc2ff; --link-hover: #d3e4ff; --danger: #ff7b6b; --ok: #4cc38a; --warn: #e0b04d;
    --add-bg: #12351f; --add-ink: #b7efc9; --del-bg: #3d1a1a; --del-ink: #f7c1c1;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 -apple-system, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:visited { color: var(--link); }
a:hover { color: var(--link-hover); }
header.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
header.top h1 { font-size: 19px; margin: 0 12px 0 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav button { background: none; border: 0; padding: 8px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; }
nav button.active { background: var(--brand); color: var(--brand-ink); }
main { padding: 20px; max-width: 1280px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.panel h2 { font-size: 18px; margin: 0 0 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 15px; color: var(--muted); }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
input[type=checkbox] { min-width: 0; }
button.btn { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.btn.sec { background: transparent; color: var(--brand); border: 1px solid var(--line); }
button.btn.danger { background: var(--danger); color: #fff; }
button.btn:disabled { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 15px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num { white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 15px; white-space: nowrap; }
.tag.ok { color: var(--ok); } .tag.off { color: var(--muted); } .tag.warn { color: var(--warn); }
.msg { padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.msg.err { background: var(--del-bg); color: var(--del-ink); }
.msg.info { background: var(--add-bg); color: var(--add-ink); }
.token { font-family: ui-monospace, Consolas, monospace; background: var(--bg); border: 1px dashed var(--warn); padding: 8px; word-break: break-all; border-radius: 6px; user-select: all; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.login { max-width: 340px; margin: 12vh auto; }
.login .panel { display: flex; flex-direction: column; gap: 12px; }
.diff-meta { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin-bottom: 12px; }
.diff-meta dt { color: var(--muted); } .diff-meta dd { margin: 0; word-break: break-word; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.cmp > div { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; min-height: 28px; }
.cmp .lbl { grid-column: 1 / -1; font-size: 15px; color: var(--muted); border: 0; padding: 0; min-height: 0; }
.cmp .before { background: var(--del-bg); color: var(--del-ink); } .cmp .after { background: var(--add-bg); color: var(--add-ink); }
.cmp .same { opacity: .6; }
pre.diff { margin: 0; padding: 0; overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 6px; font: 15px/1.45 ui-monospace, Consolas, monospace; }
pre.diff .ln { display: block; padding: 0 8px; white-space: pre-wrap; word-break: break-all; }
pre.diff .add { background: var(--add-bg); color: var(--add-ink); }
pre.diff .del { background: var(--del-bg); color: var(--del-ink); }
pre.diff .gap { color: var(--muted); background: var(--bg); text-align: center; }
pre.raw { max-height: 50vh; overflow: auto; border: 1px solid var(--line); padding: 8px; white-space: pre-wrap; word-break: break-all; font: 15px/1.45 ui-monospace, Consolas, monospace; background: var(--bg); }
details { margin-top: 8px; }
@media (max-width: 720px) { .cmp { grid-template-columns: 1fr; } main { padding: 12px; } }

/* ---- 部署分頁（deploy.js） */
.spacer { flex: 1; }
.small { font-size: 15px; }
.dep-grid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.dep-side { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 70px; }
.dep-sites { display: flex; flex-direction: column; gap: 4px; }
.dep-site { text-align: left; background: none; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; cursor: pointer; word-break: break-all; }
.dep-site:hover { border-color: var(--line); }
.dep-site.active { background: var(--brand); color: var(--brand-ink); }
.dep-site.active .muted { color: var(--brand-ink); opacity: .8; }
.dep-cfg { word-break: break-all; }
.dep-head h2 { margin: 0; }
.dep-tools { margin-bottom: 10px; }
.dep-path { font-family: ui-monospace, Consolas, monospace; font-size: 15px; word-break: break-all; }
.dep-path .tag { margin-left: 6px; }
tr.dep-dim td { opacity: .6; }
.dep-log { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; max-height: 260px; overflow: auto; font: 15px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.dep-ok { color: var(--ok); } .dep-bad { color: var(--danger); }
.dep-form { display: flex; flex-direction: column; gap: 10px; }
.dep-form .row > label.f { flex: 1; min-width: 120px; }
.dep-form label.f .row input { flex: 1; }
.dep-form textarea { font-family: ui-monospace, Consolas, monospace; }
.dep-browse { border: 1px solid var(--line); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.dep-dir { text-align: left; background: none; border: 0; padding: 4px 6px; cursor: pointer; border-radius: 4px; }
.dep-dir:hover { background: var(--bg); }
.dep-dir .tag { margin-left: 6px; }
.dep-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.dep-modal .panel { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.dep-actions { justify-content: flex-end; }
@media (max-width: 860px) { .dep-grid { grid-template-columns: 1fr; } .dep-side { position: static; } }

/* ---- A/B 實驗分頁（ab-admin.js） */
.ab-form { display: flex; flex-direction: column; gap: 10px; }
.ab-form .row > label.f { min-width: 140px; }
.ab-line > input[type=text] { flex: 1; min-width: 180px; }
.ab-title { margin: 0; }
.ab-sub { margin-top: 12px; flex: none; }
.ab-code { width: 100%; font: 15px/1.5 ui-monospace, Consolas, monospace; }
.ab-ops td { border-bottom: 0; padding-top: 0; }
.ab-ops ol { margin: 4px 0; padding-left: 20px; }
.ab-ops code { font: 15px ui-monospace, Consolas, monospace; }
a.btn { display: inline-block; text-decoration: none; background: var(--brand); color: var(--brand-ink); border-radius: 6px; padding: 7px 14px; }
a.btn.sec { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.ab-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.ab-stat b { font-size: 22px; }
tr.ab-leader td { background: var(--add-bg); }
.ab-bar { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ab-bar-track { display: inline-block; width: 70px; height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.ab-bar-fill { display: block; height: 100%; background: var(--brand); }
.ab-bar-fill.good { background: var(--ok); } .ab-bar-fill.bad { background: var(--danger); }

/* ---- 首頁 */
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.home-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }
.home-card h2 { font-size: 20px; margin: 0; }
.home-card p { margin: 0; }
.home-body { flex: 1; }
.home-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.home-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.home-stat b { font-size: 24px; }
.home-links { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 960px) { .home-grid { grid-template-columns: 1fr; } }
.home-card { align-self: start; }
.home-grid { align-items: start; }
.home-manual { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.home-manual h3 { font-size: 17px; margin: 0 0 6px; }
.home-manual details { margin-top: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; }
.home-manual summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.home-manual ol { margin: 4px 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; line-height: 1.6; }

/* ---- A/B 每日趨勢圖、部署紀錄、SEO 成效 */
.ab-chart { width: 100%; height: 260px; margin-top: 8px; }
.ab-grid { stroke: var(--line); stroke-width: 1; }
.ab-axis { fill: var(--muted); font-size: 13px; }
.ab-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ab-dot { stroke: var(--panel); stroke-width: 2; }
.ab-line.ab-c0 { stroke: var(--muted); } .ab-dot.ab-c0, .ab-key.ab-c0 { fill: var(--muted); background: var(--muted); }
.ab-line.ab-c1 { stroke: var(--brand); } .ab-dot.ab-c1, .ab-key.ab-c1 { fill: var(--brand); background: var(--brand); }
.ab-line.ab-c2 { stroke: var(--warn); } .ab-dot.ab-c2, .ab-key.ab-c2 { fill: var(--warn); background: var(--warn); }
.ab-line.ab-c3 { stroke: var(--ok); } .ab-dot.ab-c3, .ab-key.ab-c3 { fill: var(--ok); background: var(--ok); }
.ab-legend { gap: 16px; }
.ab-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tag.bad { color: var(--danger); }
.impact-page { max-width: 360px; word-break: break-all; }
.dep-hist { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-top: 6px; }
.dep-hist summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dep-hist-files { margin: 6px 0; padding-left: 18px; font-size: 15px; }
.dep-hist-files code { font-family: ui-monospace, Consolas, monospace; }
.home-overview { margin-bottom: 16px; }
.home-overview h2 { font-size: 20px; margin: 0 0 6px; }
.home-flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; counter-reset: flow; }
.home-flow li { counter-increment: flow; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 16px; line-height: 1.6; display: flex; flex-direction: column; gap: 4px; }
.home-flow li b::before { content: counter(flow) ". "; }
@media (max-width: 960px) { .home-flow { grid-template-columns: 1fr; } }
.home-features h3 { font-size: 17px; margin: 4px 0 6px; }
.home-features ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; line-height: 1.6; }
.st-list { display: flex; flex-direction: column; gap: 10px; }
.st-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.st-item { margin-bottom: 0; padding: 12px 16px; }
.st-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.st-head:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.st-date { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 16px; }
.st-title { font-size: 18px; }
.st-sum { margin-top: 6px; }
.st-detail { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 12px 0; }
.st-detail dt { color: var(--muted); font-size: 16px; }
.st-detail dd { margin: 0; white-space: pre-wrap; line-height: 1.6; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .st-detail { grid-template-columns: 1fr; } .st-detail dd { margin-bottom: 6px; } }
.st-ai { display: flex; flex-direction: column; gap: 10px; }
.st-ai textarea { font-family: ui-monospace, Consolas, monospace; font-size: 15px; width: 100%; }
.ov-table-wrap { overflow-x: auto; }
.ov-table { width: 100%; border-collapse: collapse; }
.ov-table th { text-align: left; font-size: 15px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ov-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ov-table td .tag { margin-right: 4px; }
.ov-link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.ov-link:hover { color: var(--link-hover); text-decoration: underline; }
.ov-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.ov-delta { font-size: 15px; font-variant-numeric: tabular-nums; }
.ov-delta.up { color: var(--ok); } .ov-delta.down { color: var(--danger); }
.ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 960px) { .ov-grid { grid-template-columns: 1fr; } }
.ov-sec { margin-bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.ov-h3 { font-size: 16px; color: var(--muted); margin: 6px 0 0; }
.ov-item { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ov-row { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-good { color: var(--ok); }
.ov-bad { color: var(--danger); }
.ov-files { margin: 6px 0 0; padding-left: 18px; font-size: 15px; max-height: 220px; overflow: auto; overflow-wrap: anywhere; }
header.top nav { gap: 4px; align-items: center; }
.dd { position: relative; }
.dd-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; white-space: nowrap; }
.dd-btn:hover, .dd-btn[aria-expanded="true"] { background: var(--bg); color: var(--text); }
.dd-btn.active { background: var(--brand); color: var(--brand-ink); }
.dd-btn:focus-visible, .dd-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dd-caret { font-size: 12px; opacity: .8; }
.dd-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 220px; max-width: min(320px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); padding: 6px; display: flex; flex-direction: column; }
.dd-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--text); font: inherit; cursor: pointer; }
.dd-item:hover, .dd-item:focus { background: var(--bg); }
.dd-sub { font-size: 15px; color: var(--muted); }
.dd-sep { height: 1px; background: var(--line); margin: 4px 2px; }
header.top .btn.active { border-color: var(--brand); color: var(--brand); }
@media (max-width: 760px) {
  header.top nav { flex-basis: 100%; order: 3; flex-wrap: wrap; }
  .dd-panel { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); top: auto; max-width: none; }
}
.dd-panel[hidden] { display: none; }
.dd-item.has-sub { flex-direction: column; align-items: flex-start; gap: 1px; }

/* CTA 追蹤 */
.cta-filters { align-items: flex-end; }
.cta-q { min-width: 200px; }
.cta-stats { gap: 24px; margin-bottom: 8px; }
.cta-chart { display: flex; align-items: flex-end; gap: 2px; height: 90px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cta-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 2px; }
.cta-bar { width: 100%; background: var(--brand); border-radius: 2px 2px 0 0; }
.cta-bar.future { opacity: .25; }
.cta-hours { display: flex; justify-content: space-between; padding-top: 2px; }
.cta-table td { vertical-align: top; }

.cta-url { max-width: 320px; overflow-wrap: anywhere; }
.cta-table td:last-child:not(.cta-note) { white-space: nowrap; }
.cta-table td:last-child:not(.cta-note) .btn + .btn { margin-left: 6px; }
.cta-table td.cta-source { min-width: 260px; }
.cta-table td.cta-target { min-width: 260px; }
.cta-table td.cta-btntext { max-width: 220px; overflow-wrap: anywhere; }
.cta-table td.cta-note { width: 130px; min-width: 110px; }
.cta-note input, .cta-note .btn { display: block; width: 100%; box-sizing: border-box; margin: 0 0 6px; }
.cta-note .small { display: block; }
.cta-detail td { background: var(--bg); }
.cta-clicks { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.cta-clicks li span + span { margin-left: 10px; }
.cta-off td { opacity: .6; }
.cta-form { align-items: flex-end; }
.cta-grow { flex: 1 1 260px; }
.cta-wide { width: 100%; }
.cta-code { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 10px; }
.cta-code pre { flex: 1 1 auto; margin: 0; }
.nowrap { white-space: nowrap; }
.tag.cta-line, .tag.cta-wechat { color: var(--ok); } .tag.cta-tel, .tag.cta-sms { color: var(--brand); } .tag.cta-email { color: var(--warn); }
.panel .btn.sec.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.cta-paths { font-family: ui-monospace, Consolas, monospace; }

/* 目前位置（麵包屑） */
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 1280px; margin: 0 auto; padding: 12px 20px 0; font-size: 16px; }
.crumb-sep { color: var(--muted); }
.crumb-here { font-weight: 700; color: var(--text); }

/* CTA 點擊明細表（時間 / 裝置 / IP / 訪客 / UA） */
.cta-clicks-t { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.cta-clicks-t th, .cta-clicks-t td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.cta-clicks-t .cta-ua { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 部署處理中提示（上傳 / 重啟 / 還原） */
.dep-busy { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 12px 20px; background: var(--panel); color: inherit; border: 1px solid var(--brand); border-radius: 999px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); font-size: 14px; }
.dep-spin { flex: none; width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: dep-rot .8s linear infinite; }
@keyframes dep-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dep-spin { animation-duration: 2.4s; } }

/* 部署：多台主機的每一列 */
.dep-env + .dep-env { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

/* SEO 稽核（audit.js） */
.au-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 8px 0; }
.au-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.au-stat b { font-size: 1.25rem; }
.au-actions h3 { margin: 14px 0 6px; font-size: 1rem; }
.au-wide { min-width: 320px; flex: 1; }
.au-url { word-break: break-all; }
.au-table td { vertical-align: top; }
.au-sum .tag { margin: 0 4px 4px 0; }
.au-job { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.au-results { display: grid; gap: 8px; }
.au-result { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.au-result .row { gap: 8px; flex-wrap: wrap; }
.au-suggest { color: var(--brand); margin-top: 4px; }
.au-params { width: 100%; min-width: 180px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.tag.au-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tag.au-bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.tag.au-warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.tag.au-off { opacity: .7; }
.au-busy { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.au-spin { flex: none; width: 16px; height: 16px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: dep-rot .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .au-spin { animation-duration: 2.4s; } }
.au-sec { font-variant-numeric: tabular-nums; }
.au-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.au-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s ease; }
.au-kinds { flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.au-kinds .btn.active { outline: 2px solid var(--brand); }
.au-hide { display: none; }
.op-modal { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.op-card { background: var(--panel); color: inherit; border: 1px solid var(--line); border-radius: 12px; width: min(1000px, 100%); padding: 16px 18px; }
.op-diff { white-space: pre-wrap; word-break: break-all; font: 12px/1.55 ui-monospace, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 60vh; overflow: auto; }
.op-add { display: block; background: color-mix(in srgb, var(--ok) 18%, transparent); }
.op-del { display: block; background: color-mix(in srgb, var(--danger) 16%, transparent); text-decoration: line-through; }
.op-eq, .op-gap { display: block; opacity: .6; }

/* 網站選擇器（可輸入搜尋）— site-picker.js */
.sp { position: relative; width: 100%; max-width: 560px; }
.sp-input { width: 100%; }
.sp-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; max-height: 340px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); padding: 4px; }
.sp-item { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.sp-item.active { background: var(--brand); color: var(--brand-ink); }
.sp-item.cur:not(.active) { font-weight: 600; }
.sp-dom { color: var(--muted); font-size: 14px; white-space: nowrap; }
.sp-item.active .sp-dom { color: inherit; }
.sp-empty { padding: 8px 10px; color: var(--muted); }

/* 欄位說明「?」：滑鼠移上去或 Tab 到時顯示 data-tip — site-picker.js 的 SeoUi.tip */
.tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 5px; border: 1px solid var(--muted); border-radius: 50%; font-size: 11px; font-weight: 700; line-height: 1; color: var(--muted); cursor: help; vertical-align: middle; }
.tip:hover, .tip:focus { color: var(--brand); border-color: var(--brand); outline: none; }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: 30; width: max-content; max-width: 300px; padding: 8px 10px; background: var(--text); color: var(--bg); border-radius: 6px; font-size: 13px; font-weight: 400; line-height: 1.55; white-space: normal; text-align: left; visibility: hidden; opacity: 0; transition: opacity .12s; pointer-events: none; }
.tip:hover::after, .tip:focus::after { visibility: visible; opacity: 1; }
.sp-field { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 260px; max-width: 560px; }
.au-report .panel { margin-bottom: 10px; }

/* 待優化文章（AI 協作修改）— workbench.js */
.wb-tier { display: inline-flex; align-items: center; }
.wb-card { width: min(1100px, 100%); }
.wb-card h4 { margin: 14px 0 6px; }
.wb-ins { width: 100%; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.wb-form { display: flex; flex-direction: column; gap: 10px; }
.wb-field { display: flex; flex-direction: column; gap: 3px; }
.wb-field label { font-size: 15px; color: var(--muted); }
.wb-field input, .wb-field textarea { width: 100%; }
#assist-html_content, #assist-faq { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.wb-actions { margin-top: 12px; }
.wb-agent-box { margin: 10px 0 4px; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 8px; }
.wb-agent { width: 100%; margin-top: 6px; font-size: 14px; }
.op-conn summary { cursor: pointer; color: var(--muted); padding: 4px 0; }

/* ---- 後台外框：左側導覽 + 頁面標題 + 麵包屑（2026-11-02） */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.shell-col { min-width: 0; }
.topbar, .scrim { display: none; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.side-brand, .side-brand:visited { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; padding: 4px 10px; }
nav.side-nav { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 4px; flex: 1 0 auto; }
.side-link, .side-link:visited { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 6px; color: var(--text); text-decoration: none; line-height: 1.35; overflow-wrap: anywhere; }
.side-link:hover { background: var(--bg); color: var(--text); }
.side-link.current, .side-link.current:visited, .side-link.current:hover { background: var(--brand); color: var(--brand-ink); }
.side-link-sub { font-size: 14px; color: var(--muted); }
.side-link.current .side-link-sub { color: inherit; }
.side-link.side-site.open:not(.current) { font-weight: 700; }
.side-top { font-weight: 600; }
.side-group { margin: 0; }
.side-group > summary { cursor: pointer; padding: 7px 10px; border-radius: 6px; font-weight: 600; }
.side-group > summary:hover { background: var(--bg); }
.side-group-body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 6px 12px; }
.side-search { width: 100%; margin-bottom: 4px; }
.side-sites { display: flex; flex-direction: column; gap: 2px; }
.side-blocks { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 10px; padding-left: 8px; border-left: 2px solid var(--line); }
.side-empty { padding: 6px 10px; color: var(--muted); font-size: 15px; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 2px; border-top: 1px solid var(--line); }
.side a:focus-visible, .side summary:focus-visible, .page-tabs a:focus-visible, .crumb a:focus-visible, .page-desc a:focus-visible, .block-card a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.page-head { max-width: 1280px; margin: 0 auto; padding: 16px 20px 0; }
nav.crumb { display: block; max-width: none; margin: 0; padding: 0; flex: none; font-size: 15px; }
.crumb ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.crumb li { overflow-wrap: anywhere; }
.crumb li + li::before { content: "›"; margin: 0 8px; color: var(--muted); }
.page-title { margin: 6px 0 2px; font-size: 28px; line-height: 1.25; overflow-wrap: anywhere; }
.page-title:focus { outline: none; }
.page-desc { margin: 0; color: var(--muted); max-width: 72ch; }
nav.page-tabs { display: flex; flex-wrap: nowrap; flex: none; gap: 4px; margin-top: 14px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.page-tabs a, .page-tabs a:visited { padding: 8px 12px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.page-tabs a:hover { color: var(--text); }
.page-tabs a.current, .page-tabs a.current:visited { color: var(--text); font-weight: 700; border-bottom-color: var(--brand); }
main.page-main { padding: 16px 20px 32px; max-width: 1280px; margin: 0 auto; }

.block-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
.block-card { margin: 0; }
.block-card h2 { margin: 0 0 2px; font-size: 21px; }
.block-card h2 a, .block-card h2 a:visited { color: var(--text); text-decoration: none; }
.block-card h2 a:hover { text-decoration: underline; }
.block-card > p { margin: 0 0 8px; }
.block-fns { margin: 0; padding: 0; list-style: none; }
.block-fns li { display: flex; flex-direction: column; padding: 7px 0; border-top: 1px solid var(--line); }
.block-fns a { font-weight: 600; }
.section-title { font-size: 19px; margin: 20px 0 10px; }

@media (max-width: 860px) {
  .shell { display: block; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-100%); visibility: hidden; }
  .drawer-open .side { transform: none; visibility: visible; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); }
  .page-head { padding: 12px 16px 0; }
  .page-title { font-size: 24px; }
  main.page-main { padding: 12px 16px 24px; }
  .block-grid { grid-template-columns: 1fr; }
}
.side-sep { width: 100%; margin: 5px 0; border: 0; border-top: 1px solid var(--line); }
tr.ov-group-start > td { border-top: 3px solid var(--line); }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-link { flex-direction: row; align-items: center; gap: 9px; }
.side-link-body { display: flex; flex-direction: column; min-width: 0; }
.side-group > summary .ico { margin: 0 7px 0 3px; vertical-align: -3px; }
nav.page-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.block-card h2 a, .block-fns a { display: inline-flex; align-items: center; gap: 8px; }
.block-card h2 .ico { width: 22px; height: 22px; color: var(--brand); }
.block-fns li > .small { padding-left: 26px; }
.section-title.first { margin-top: 0; }
.setup { padding: 0 16px; }
.setup-row { margin: 0; border-top: 1px solid var(--line); }
.setup-row:first-child { border-top: 0; }
.setup-row > summary { display: flex; align-items: center; gap: 10px; padding: 11px 0; cursor: pointer; list-style: none; }
.setup-row > summary::-webkit-details-marker { display: none; }
.setup-row > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.setup-row > summary::after { content: "▸"; color: var(--muted); }
.setup-row[open] > summary::after { content: "▾"; }
.setup-row > summary .ico { color: var(--brand); }
.setup-name { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.setup-row > summary > .tag { white-space: normal; text-align: center; }
.setup-body { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 16px 28px; }
.setup-body p { margin: 0; }
.setup-body .ab-code { width: 100%; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.setup-field input { width: 100%; }
.setup-body .panel { border: 0; padding: 0; margin: 0; background: none; }
.setup-body .panel > h2 { display: none; }
@media (max-width: 640px) { .setup-body { padding-left: 0; } .setup-row > summary { flex-wrap: wrap; } .setup-name { flex-basis: calc(100% - 60px); } }
.section-head { align-items: center; margin-bottom: 10px; }
.section-head .section-title { margin: 0; }
.cache-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
@media (max-width: 860px) { .shell-col { overflow-x: clip; } }
.mv-head { align-items: center; margin-bottom: 12px; }
.mv-head p { margin: 0; flex: 1; min-width: 240px; }
.mv-page { min-width: 260px; overflow-wrap: anywhere; }
.mv-page .ov-link { margin-right: 8px; }
.mv-up > h2 { color: var(--ok); }
.mv-down > h2 { color: var(--danger); }
.st-ai-steps { margin: 0; padding-left: 22px; }
.sub-tabs { margin: 0 0 16px; }
.new-site > h2 { margin: 22px 0 8px; }
.new-site > h2:first-child { margin-top: 0; }
.new-site > p { margin: 0 0 8px; }
.new-site > .row { margin-top: 10px; }
.new-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tag.bad { color: var(--danger); }
.new-actions { margin-top: 18px; align-items: center; }
.btn-link, .btn-link:visited { background: var(--brand); color: var(--brand-ink); border-radius: 6px; padding: 7px 14px; text-decoration: none; }
.btn-link:hover { color: var(--brand-ink); }
.mv-sites { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mv-site { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; color: var(--text); cursor: pointer; }
.mv-site.current { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.mv-site.current span { color: inherit; }
.mv-dirs { margin-bottom: 10px; border-bottom: 1px solid var(--line); gap: 4px; }
.mv-dir { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.mv-dir.mv-up.current { color: var(--ok); border-bottom-color: var(--ok); }
.mv-dir.mv-down.current { color: var(--danger); border-bottom-color: var(--danger); }
.mv-site:focus-visible, .mv-dir:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.toasts { position: fixed; right: 20px; top: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 6px; background: var(--ok); color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); overflow-wrap: anywhere; }
.toast.err { background: var(--danger); }
@media (prefers-color-scheme: dark) { .toast { color: #0b1020; } }
 }
.toast.busy { background: var(--panel); color: var(--text); border: 1px solid var(--line); }

/* ---- 標題層級（全後台一致）：頁面 30 → 區塊 24 → 卡片 19 → 小標 17 → 內文 17 */
.page-title { font-size: 30px; font-weight: 700; }
.section-title, .section-head .section-title { font-size: 24px; font-weight: 700; line-height: 1.3; margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.section-title.first, .section-head .section-title.first { margin-top: 12px; }
.section-head { margin: 0 0 14px; padding-bottom: 8px; align-items: flex-end; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.section-head .section-title, .section-head .section-title.first { margin: 12px 0 0; border-bottom: 0; }
.panel h2, .panel h2.ab-title { font-size: 19px; font-weight: 700; }
.panel h3 { font-size: 17px; font-weight: 700; }
.new-site > h2 { font-size: 21px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .page-title { font-size: 25px; } .section-title, .section-head .section-title { font-size: 21px; } }
.help-search { width: 100%; max-width: 420px; margin-bottom: 10px; }
.help-tabs { display: flex; flex-wrap: wrap; flex: none; gap: 2px 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.help-tabs a, .help-tabs a:visited { padding: 8px 12px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.help-tabs a:hover { color: var(--text); }
.help-tabs a.current, .help-tabs a.current:visited { color: var(--text); font-weight: 700; border-bottom-color: var(--brand); }
.help-tabs a.caution, .help-tabs a.caution:visited { color: var(--warn); font-weight: 700; }
.help-tabs a.caution.current { border-bottom-color: var(--warn); }
.help-tabs a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.help-ch { max-width: 900px; }
.help-ch > p { margin: 0 0 8px; }
.help-sec { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.help-sec h3 { margin: 0 0 8px; }
.help-sec p { margin: 0 0 8px; }
.help-sec ol { margin: 0 0 8px; padding-left: 24px; }
.help-sec li { margin-bottom: 4px; }
.help-dl { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 6px 14px; margin: 0 0 8px; }
.help-dl dt { font-weight: 600; overflow-wrap: anywhere; }
.help-dl dd { margin: 0; }
.help-note { padding: 8px 12px; border-left: 3px solid var(--warn); background: var(--bg); }
@media (max-width: 640px) { .help-dl { grid-template-columns: 1fr; gap: 2px; } .help-dl dd { margin-bottom: 8px; } }
.change-check { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.row[hidden] { display: none; }
.pre-wrap { white-space: pre-wrap; }
.tl-day { margin: 20px 0 8px; font-size: 1.05rem; }
.tl-list { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.tl-item { padding: 0 0 16px; }
.tl-title { margin-top: 6px; font-weight: 600; }
.tl-scroll { max-height: 420px; overflow-y: auto; }
.chg-table { table-layout: fixed; width: 100%; min-width: 860px; }
.chg-table td, .chg-table th { overflow-wrap: anywhere; }
.chg-table th:first-child { width: 96px; }
.chg-table th:last-child { width: 96px; }
.chg-diff { margin-top: 6px; }
