/* Myidea 服務頁（註冊、登入、法律頁、客人聊天頁、嵌入版、企業後台）的共用樣式。
   色彩、圓角、陰影照 App 的設計規範：灰白畫布、白卡浮在上面、一支藍色只指重點。
   對外頁面的頁首頁尾在 /site/frame.css、法律與政策中心在 /site/legal.css；這裡是頁面裡的元素。 */
:root {
  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --surface2: #F2F3F5;
  --surface3: #E9EAED;
  --field: #F2F3F5;
  --field-canvas: #E9EAED;
  --chat-canvas: #ECEEF1;
  --line: #ECECEF;
  --ink: #0A0C10;
  --ink2: #33363D;
  --muted: #53575F;
  --ink4: #868A92;
  --placeholder: #6A6E76;
  --acc: #2481CC;
  --acc-ink: #1A66A3;
  --acc-tint: rgba(36, 129, 204, 0.10);
  --acc-line: rgba(36, 129, 204, 0.28);
  --control: #1D6BB2;
  --control-pressed: #175994;
  --ok: #147745;
  --ok-tint: rgba(20, 119, 69, 0.07);
  --warn: #9A5800;
  --warn-tint: rgba(154, 88, 0, 0.07);
  --danger: #C0352A;
  --danger-tint: rgba(192, 53, 42, 0.07);
  --bubble-ai: #DBE9F7;
  --sh1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --sh2: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.07);
  --r-control: 14px;
  --r-card: 24px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--acc-ink); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--acc); outline-offset: 2px;
}
h1 { font-size: 28px; line-height: 1.3; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 1.35; margin: 32px 0 12px; }
h3 { font-size: 16px; margin: 0 0 4px; }
p { margin: 0 0 16px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(10, 12, 16, 0.06);
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.top nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.top nav a { text-decoration: none; color: var(--muted); }
.inline { display: inline; margin: 0; }
.link { border: 0; background: none; padding: 0; font: inherit; color: var(--acc-ink); cursor: pointer; }
.top .link { color: var(--muted); }

main { padding: 32px 20px 56px; margin: 0 auto; }
.narrow { max-width: 440px; }
.wide { max-width: 680px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  background: var(--control);
  color: #fff;
  border-radius: var(--r-control);
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease-out, background-color 0.15s ease-out;
}
.btn:hover { background: var(--control-pressed); }
.btn:active { transform: scale(0.98); background: var(--control-pressed); }
.btn.ghost { background: var(--surface3); color: var(--ink2); }
.btn.ghost:hover { background: #E1E3E7; }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; font-weight: 600; }
.btn:disabled { opacity: 0.45; cursor: default; }
.danger-text { color: var(--danger) !important; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }

.stack { display: grid; gap: 16px; margin: 0 0 24px; }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--ink); }
.field > span { font-weight: 600; }
.field small { color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  border: 1px solid transparent;
  background-color: var(--field-canvas);
  border-radius: var(--r-control);
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
}
.card input[type="text"], .card input[type="email"], .card input[type="password"], .card textarea, .card select { background-color: var(--field); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
::placeholder { color: var(--placeholder); }
input:focus, textarea:focus, select:focus { outline: none; background-color: var(--surface) !important; border-color: var(--acc); }
textarea { resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--control); flex: none; }

.muted { color: var(--muted); font-size: 14px; }
.small-note { font-size: 13px; }
.alert { background: var(--danger-tint); color: var(--danger); border-radius: var(--r-control); padding: 12px 14px; font-size: 14px; }
.notice { background: var(--acc-tint); color: var(--acc-ink); border-radius: var(--r-control); padding: 12px 14px; font-size: 14px; }
.notice.warn { background: var(--warn-tint); color: var(--warn); }

.code-box {
  background: var(--surface);
  box-shadow: var(--sh1);
  border-radius: var(--r-card);
  padding: 20px;
  margin: 0 0 20px;
  display: grid;
  gap: 4px;
  text-align: center;
}
.code-box span { color: var(--muted); font-size: 14px; }
.code-box strong { font-size: 40px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.code-inline { font-variant-numeric: tabular-nums; letter-spacing: 0.05em; color: var(--ink); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.members { list-style: none; padding: 0 20px; margin: 0 0 24px; }
.member { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.member:last-child { border-bottom: 0; }
.member-head { display: grid; gap: 2px; }
.member-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.member-actions form { margin: 0; }
.row { display: flex; gap: 8px; flex: 1 1 260px; }
.row input { flex: 1; min-width: 0; padding: 8px 12px; }

/* ── 註冊、登入、訊息頁（對外頁面，外框與 --sh-card、--header-h 在 frame.css）
   桌機與平板：白卡在頁首以下那一屏裡置中（下方多留一點，視覺上略偏上），頁尾留到捲動後才出現；
   手機：白卡貼著頁首往下排，鍵盤跳出時不會把卡片推走。 */
.auth { max-width: 488px; padding: 48px 20px 72px; }
.auth-card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--sh-card, var(--sh1)); padding: 32px 28px 28px; }
@media (min-width: 641px) {
  .auth { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - var(--header-h, 68px)); padding: 56px 20px 104px; }
}
.auth-card h1 { margin-bottom: 24px; }
.auth-card .stack { margin-bottom: 0; }
.auth-card input[type="text"], .auth-card input[type="email"], .auth-card input[type="password"] { background-color: var(--field); }
.auth-card .btn { width: 100%; margin-top: 4px; }
.auth-card .code-box { box-shadow: none; background: var(--surface2); }
.auth-alt { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 15px; }
.message { padding: 72px 20px 96px; }
@media (max-width: 480px) {
  .auth { padding: 28px 20px 56px; }
  .auth-card { padding: 24px 20px 22px; }
}

.foot { padding: 24px 20px; color: var(--muted); font-size: 13px; }
.foot nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.foot a { color: var(--muted); }
.foot p { margin: 0; }

/* ── 客人聊天頁（/c/:slug） */
.chat-body { background: var(--chat-canvas); }
.chat-body .top { padding: 10px 16px; }
.chat { max-width: 640px; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.chat-head { padding: 20px 0 12px; }
.chat-head h1 { font-size: 22px; margin: 0 0 6px; }
.chat-ent { color: var(--muted); font-size: 14px; margin: 0 0 2px; }
.chat-note { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
.chat-note a { color: var(--muted); white-space: nowrap; }
.composer textarea:disabled { opacity: 0.6; cursor: not-allowed; }

.log { list-style: none; margin: 0; padding: 16px 0 0; display: flex; flex-direction: column; gap: 10px; min-height: 40vh; }
.msg { max-width: 82%; }
.msg p { margin: 0; padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .who { display: block; font-size: 12px; color: var(--muted); margin: 0 0 2px 8px; }
.msg.mine { align-self: flex-end; }
.msg.mine p { background: var(--control); color: #fff; border-bottom-right-radius: 6px; }
.msg.theirs { align-self: flex-start; }
.msg.theirs p { background: var(--surface); box-shadow: var(--sh1); border-bottom-left-radius: 6px; }
.msg.pending { opacity: 0.5; }
.msg.typing p { color: var(--muted); }
.msg.system { align-self: center; max-width: 100%; }
.msg.system p { padding: 2px 0; font-size: 13px; color: var(--muted); text-align: center; background: none; box-shadow: none; }

.composer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, 0.04);
}
.composer textarea { flex: 1; resize: none; max-height: 120px; border-radius: 20px; background: var(--field); }
.composer .btn { border-radius: 20px; padding: 12px 18px; }

@media (min-width: 680px) {
  .composer { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border-radius: 20px 20px 0 0; }
}

/* 整頁聊天：輸入框與告知列一起固定在底部 */
.chat-body .chat { padding-bottom: calc(128px + env(safe-area-inset-bottom)); }
.chat-dock { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); box-shadow: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, 0.04); padding-bottom: env(safe-area-inset-bottom); }
.chat-dock .composer { position: static; width: auto; transform: none; border-radius: 0; box-shadow: none; padding: 10px 16px 6px; }
.chat-dock .chat-note { font-size: 11px; text-align: center; padding: 0 16px 8px; }
@media (min-width: 680px) {
  .chat-dock { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border-radius: 20px 20px 0 0; }
}

/* ── 嵌在企業官網的客服視窗（/w/:slug，iframe 內）：撐滿 iframe，訊息區自己捲 */
.widget-body { height: 100vh; height: 100dvh; overflow: hidden; background: var(--chat-canvas); }
.chat.widget { display: flex; flex-direction: column; height: 100%; max-width: none; padding: 0; }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 10px 16px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.widget-title { min-width: 0; }
.widget-head h1 { font-size: 17px; line-height: 1.3; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-head .chat-ent { font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-close { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.widget-close:hover, .widget-close:focus-visible { background: var(--surface2); outline: none; }
.chat.widget .log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.chat.widget .composer { position: static; left: auto; right: auto; width: auto; transform: none; border-radius: 0; padding: 10px 12px; box-shadow: 0 -1px 0 var(--line); }
.chat.widget .chat-note { font-size: 11px; text-align: center; padding: 0 16px 10px; background: var(--surface); }
.widget-gone > p { padding: 16px; }

/* ── 企業後台（/admin/*） */
.admin-body { min-height: 100vh; display: flex; flex-direction: column; }
.admin-top { display: flex; align-items: center; gap: 16px; padding: 12px max(20px, calc((100% - 880px) / 2 + 20px)); background: var(--surface); flex-wrap: wrap; }
.admin-brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 650; font-size: 17px; letter-spacing: -0.02em; }
.admin-brand img { border-radius: 7px; display: block; }
.admin-ent { margin: 0; display: grid; line-height: 1.3; font-size: 14px; min-width: 0; }
.admin-ent strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-ent span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.admin-tools { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 14px; }
.admin-tools a, .admin-tools .link { color: var(--muted); text-decoration: none; }
.admin-me { color: var(--ink2); }
.admin-nav { display: flex; gap: 4px; padding: 0 max(8px, calc((100% - 880px) / 2 + 8px)); background: var(--surface); box-shadow: 0 1px 0 var(--line); overflow-x: auto; scrollbar-width: none; }
.admin-nav a { flex: none; padding: 12px 12px 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; border-bottom: 2px solid transparent; min-height: 44px; }
.admin-nav a.is-active { color: var(--acc-ink); border-bottom-color: var(--acc); }
.admin-body .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.grid2 > .field { align-content: start; }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 2px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; vertical-align: 1px; }
.admin-main { width: 100%; max-width: 880px; padding: 28px 20px 56px; flex: 1; }
.admin-main h1 { font-size: 26px; }
.admin-foot { max-width: 880px; width: 100%; margin: 0 auto; }

.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--sh1); padding: 20px; margin: 0 0 20px; }
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
.card.stack { display: grid; gap: 16px; }
.card.stack > * { margin-bottom: 0; }
.narrow-card { max-width: 480px; }
.danger-zone h2 { color: var(--danger); font-size: 17px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.back { font-size: 14px; text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat { display: grid; gap: 2px; padding: 16px 18px; border-radius: 20px; background: var(--surface); box-shadow: var(--sh1); text-decoration: none; color: var(--ink2); }
.stat strong { font-size: 28px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 14px; }
.stat-warn strong { color: var(--warn); }
.stat-ok strong { color: var(--ok); }
.stat-acc strong { color: var(--acc-ink); }

.steps-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.steps-list .step { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps-list .step:last-child { border-bottom: 0; }
.steps-list p { margin: 0; color: var(--muted); font-size: 14px; }
.step-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--acc-tint); color: var(--acc-ink); font-weight: 700; font-size: 14px; }
.step.is-done .step-n { background: var(--ok-tint); color: var(--ok); }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.chip-acc { background: var(--acc-tint); color: var(--acc-ink); }
.chip-ok { background: var(--ok-tint); color: var(--ok); }
.chip-warn { background: var(--warn-tint); color: var(--warn); }
.chip-warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.chip-quiet { background: var(--surface2); color: var(--muted); }
.chip-danger { background: var(--danger-tint); color: var(--danger); }
.chip-purpose { background: transparent; color: var(--ink2); box-shadow: inset 0 0 0 1px var(--surface3); }

.tabs { display: flex; gap: 8px; margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tabs a { flex: none; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink2); font-size: 14px; font-weight: 600; background: var(--surface); box-shadow: var(--sh1); min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.tabs a.is-active { background: var(--control); color: #fff; box-shadow: none; }
.tabs .count { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.8; }

.conv-list { list-style: none; margin: 0 0 20px; padding: 4px 0; }
.conv-list li + li .conv { border-top: 1px solid var(--line); }
.card.conv-list { padding: 4px 0; }
.conv { display: flex; gap: 12px; padding: 14px 20px; text-decoration: none; color: var(--ink); }
.conv:hover { background: var(--surface2); }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; background: #4F5FCB; }
.avatar.big { width: 52px; height: 52px; font-size: 20px; }
.conv-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.conv-top { display: flex; justify-content: space-between; gap: 12px; }
.conv-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-top time { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.conv-meta { color: var(--ink2); font-size: 14px; }
.conv-last { color: var(--muted); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.conv-head { display: flex; gap: 14px; align-items: center; margin: 8px 0 12px; }
.conv-head h1 { margin: 0; font-size: 22px; }
.conv-head p { margin: 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.actions-row form { margin: 0; }
.conv-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin: 0 0 16px; }
.conv-actions .actions-row { margin: 0; }
.thread-wrap { padding: 0; overflow: hidden; }
.thread { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--chat-canvas); max-height: 60vh; min-height: 240px; overflow-y: auto; }
.try .thread { border-radius: 20px; margin: 0 0 12px; }
.tmsg { max-width: 82%; }
.tmsg p { margin: 0; padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tmsg .who { display: block; font-size: 12px; color: var(--muted); margin: 0 8px 2px; }
.tmsg .flagged { color: var(--warn); }
.tcustomer { align-self: flex-start; }
.tcustomer p { background: var(--surface); box-shadow: var(--sh1); border-bottom-left-radius: 6px; }
.tai { align-self: flex-end; }
.tai p { background: var(--bubble-ai); border-bottom-right-radius: 6px; }
.tai .who, .tstaff .who { text-align: right; }
.tstaff { align-self: flex-end; }
.tstaff p { background: var(--control); color: #fff; border-bottom-right-radius: 6px; }
.tsys { align-self: center; max-width: 100%; }
.tsys p { padding: 2px 0; font-size: 13px; color: var(--muted); text-align: center; }
.typing p { color: var(--muted); }
.try .tcustomer { align-self: flex-end; }
.try .tcustomer p { background: var(--control); color: #fff; border-bottom-left-radius: 20px; border-bottom-right-radius: 6px; }
.try .tcustomer .who { text-align: right; }
.try .tai { align-self: flex-start; }
.try .tai p { border-bottom-right-radius: 20px; border-bottom-left-radius: 6px; }
.try .tai .who { text-align: left; }
.reply { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; margin: 0; }
.reply textarea { flex: 1; resize: none; min-height: 48px; max-height: 160px; border-radius: 20px; }
.reply .btn { border-radius: 20px; }
.thread-wrap .small-note { padding: 0 16px 14px; margin: 0; }

.agent-grid { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 16px; }
.agent-card { margin: 0; display: grid; gap: 6px; }
.agent-card p { margin: 0; }
.agent-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.agent-card h2 { margin: 0; font-size: 18px; }
.agent-card h2 a { color: var(--ink); text-decoration: none; }
.agent-card .actions-row { margin: 8px 0 0; }
.agent-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.agent-head h1 { margin: 0; }
.agent-form .card { margin-bottom: 16px; }
.grid2 { display: grid; gap: 16px; }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); box-shadow: 0 -1px 0 var(--line); margin: 0 0 20px; }
.save-bar .btn { width: 100%; }
.table-wrap { overflow-x: auto; }
.products { width: 100%; border-collapse: separate; border-spacing: 0 8px; min-width: 520px; }
.products th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 6px; }
.products td { padding: 0 4px; vertical-align: top; }
.products td:nth-child(1) { width: 34%; }
.products td:nth-child(2) { width: 18%; }
.products input { padding: 10px 12px; }
.row-form { margin: 0; }

.code-copy { display: flex; gap: 8px; align-items: flex-start; }
.code-copy pre { flex: 1; margin: 0; min-width: 0; background: var(--surface2); border-radius: var(--r-control); padding: 12px 14px; overflow-x: auto; }
.code-copy code { font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.options { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.options li { display: grid; gap: 2px; font-size: 14px; }
.options code, .small-note code { font-size: 12.5px; background: var(--surface2); border-radius: 6px; padding: 2px 6px; justify-self: start; overflow-wrap: anywhere; }
.options span { color: var(--muted); }
.key-list { list-style: none; padding: 4px 20px; }
.key-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.key-row:last-child { border-bottom: 0; }
.key-row > div { display: grid; min-width: 0; }
.key-row form { margin: 0; }
.key-row .btn { flex: none; white-space: nowrap; }
.key-row .muted { overflow-wrap: anywhere; }

/* 後台：卡片標題列、總覽的 AI 專員清單、開始使用步驟 */
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 8px; }
.card-head h2 { margin: 0; }
.small-link { font-size: 14px; text-decoration: none; }
.roster { list-style: none; margin: 0 -20px -12px; padding: 0; }
.roster li + li a { border-top: 1px solid var(--line); }
.roster a { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 12px 20px; text-decoration: none; color: var(--ink); }
.roster a:hover { background: var(--surface2); }
.roster-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.step-done { color: var(--ok); font-size: 14px; font-weight: 600; white-space: nowrap; }

/* 後台：AI 專員卡片與用途 */
.agent-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agent-link { color: var(--muted); overflow-wrap: anywhere; }
.purpose-cards { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.purpose-cards legend { font-size: 14px; font-weight: 600; padding: 0; margin: 0 0 6px; }
.purpose-card { position: relative; display: grid; gap: 2px; padding: 12px 14px 12px 42px; border-radius: var(--r-control); background: var(--field); cursor: pointer; box-shadow: inset 0 0 0 1px transparent; }
.purpose-card input { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; margin: 0; accent-color: var(--control); }
.purpose-card:has(input:checked) { background: var(--acc-tint); box-shadow: inset 0 0 0 1px var(--acc-line); }
.purpose-card:has(input:focus-visible) { outline: 2px solid var(--acc); outline-offset: 2px; }
.purpose-name { font-weight: 600; font-size: 15px; }
.purpose-what { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* 後台：表單按鈕在寬畫面不撐滿；回報的原因選項 */
.choices { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.choices legend { font-size: 14px; font-weight: 600; padding: 0; margin: 0 0 8px; }
.choices .check { font-size: 15px; }

/* 後台：使用前同意 */
.consent { max-width: 680px; margin-left: auto; margin-right: auto; }
.consent h2 { font-size: 17px; margin: 24px 0 8px; }
.consent h3 { font-size: 14px; margin: 0 0 6px; color: var(--ink2); }
.consent-lists { display: grid; gap: 16px; margin: 0 0 16px; padding: 16px; border-radius: var(--r-control); background: var(--surface2); }
.plain-list { margin: 0; padding-left: 20px; font-size: 14px; }
.plain-list li + li { margin-top: 4px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 12px; }
.consent-actions form { margin: 0; }

/* 後台：成員清單（重設密碼收在展開裡） */
.admin-main .member { grid-template-columns: 1fr; }
.admin-main .member-head strong .muted { font-weight: 400; }
.reset > summary { list-style: none; }
.reset > summary::-webkit-details-marker { display: none; }
.reset[open] { order: 5; flex-basis: 100%; display: grid; gap: 8px; justify-items: start; }
.reset[open] > summary { background: var(--acc-tint); color: var(--acc-ink); }
.reset > form { width: 100%; max-width: 480px; }

/* 後台：聊天連結 QR 碼、預覽 */
.qr { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.qr-code { margin: 0; width: 148px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr > div { display: grid; gap: 8px; justify-items: start; flex: 1 1 200px; }
.qr p { margin: 0; }
.preview-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* 後台：產品表在手機上改成一列一張（名稱＋價格一排、說明一排） */
@media (max-width: 679px) {
  .products { min-width: 0; border-spacing: 0; }
  .products thead { display: none; }
  .products tr { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .products td { padding: 0; width: auto !important; }
  .products td:nth-child(3) { grid-column: 1 / -1; }
}

@media (min-width: 680px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-main .stack > .btn, .admin-main .stack > .actions-row { justify-self: start; }
  .admin-main .stack > .btn { min-width: 160px; }
  .purpose-cards { grid-template-columns: 1fr 1fr; }
  .consent-lists { grid-template-columns: 1fr 1fr; }
  .admin-main .member { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; }
  .admin-main .member-actions { justify-content: flex-end; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .agent-grid { grid-template-columns: 1fr 1fr; }
  .save-bar .btn { width: auto; min-width: 200px; }
  .options li { grid-template-columns: minmax(0, 260px) 1fr; align-items: baseline; gap: 12px; }
}

/* 後台：頁首小鈴鐺、勾選清單、收件匣篩選、通知 */
.admin-bell { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink2); }
.admin-bell:hover, .admin-bell.is-active { background: var(--surface2); }
.admin-bell .nav-count { position: absolute; top: 0; right: -4px; margin: 0; }
.checks { display: grid; gap: 8px; }
.inbox-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 12px; max-width: 360px; }
.inbox-filter .field { flex: 1; }
.notice-list .notice-item { display: flex; align-items: center; gap: 8px; padding-right: 16px; }
.notice-list li + li { border-top: 1px solid var(--line); }
.notice-list li + li .conv { border-top: 0; }
.notice-item .conv { flex: 1; min-width: 0; }
.notice-item .actions-row { margin: 0; flex-wrap: nowrap; }
.notice-item.is-unread .conv-top strong::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--acc); vertical-align: 2px; }
.notice-item:not(.is-unread) .conv-top strong { font-weight: 500; }
.pre { white-space: pre-wrap; }

/* ── 後台「預覽」用的模擬網站 */
.preview-body { background: #fff; }
.preview-top { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--muted); }
.preview-logo { width: 28px; height: 28px; border-radius: 8px; background: var(--surface3); }
.preview-main { max-width: 720px; }
.preview-block { height: 96px; border-radius: 16px; background: var(--surface2); margin: 0 0 16px; }
.card > .conv-list { margin: 0 -20px -12px; padding: 0; }

/* 示範入口站（/demo）頂端的標示：一眼看得出這是測試用的示範網站。 */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 24px; background: #FFF4D6; color: #5A4300; font-size: 14px; border-bottom: 1px solid #F0DFA8; }
.demo-banner strong { padding: 2px 10px; border-radius: 999px; background: #5A4300; color: #fff; font-size: 12px; letter-spacing: 0.04em; white-space: nowrap; }

/* 訪客第一次傳訊息前的 AI 同意：同意前只顯示這一塊，不顯示輸入框 */
.chat-consent { display: none; }
.chat.needs-consent .chat-consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, 0.04);
}
.chat.widget.needs-consent .chat-consent { position: static; }
.chat-consent p { margin: 0; font-size: 14px; line-height: 1.6; }
.chat-consent a { color: inherit; }
.chat.needs-consent .chat-dock, .chat.needs-consent .composer, .chat.needs-consent .chat-note { display: none; }
