:root {
  --paper: #ffffff;
  --ink: #1a2731;
  --muted: #585858;
  --navy: #3155a4;
  --navy-deep: #243f7c;
  --rose: #a37462;
  --line: #e2e2e2;
  --ivory: #ffffff;
  --soft: #f7f7f7;
  --shadow: 0 16px 40px rgba(26, 39, 49, 0.12);
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "WenQuanYi Micro Hei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--paper);
  line-height: 1.65;
}
a { color: var(--navy); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.topbar-inner {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 0;
}
.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--navy); }

.site-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.logo-img { display: block; height: 52px; width: auto; }
.brand strong { display: block; font-size: 18px; font-weight: 700; letter-spacing: 0.08em; line-height: 1.1; }
.brand small { color: var(--muted); letter-spacing: 0.08em; }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { text-decoration: none; color: #333; font-weight: 500; }
.nav a:hover { color: var(--navy); }
.nav-btn {
  border: 2px solid var(--navy);
  color: var(--navy) !important;
  padding: 6px 14px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

.hero-band {
  background:
    linear-gradient(180deg, rgba(49, 85, 164, 0.06), transparent 70%),
    #fff;
  border-bottom: 1px solid var(--line);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 36px;
  align-items: center;
  padding: 42px 0 36px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--navy);
  letter-spacing: 0.18em;
  font-size: 13px;
  font-weight: 700;
}
h1 {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 48px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
}
.lede { font-size: 16px; color: var(--muted); max-width: 40em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn {
  border: 2px solid var(--navy);
  border-radius: 3px;
  padding: 10px 18px;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.btn.secondary { background: #fff; color: var(--navy); }
.btn:hover { background: var(--navy-deep); color: #fff; }
.fine { color: var(--muted); font-size: 13px; }

.news-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--rose);
  padding: 16px 18px 8px;
}
.news-head, .news-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.news-head { justify-content: space-between; margin-bottom: 6px; }
.news-head h2 { margin: 0; font-size: 20px; color: var(--rose); letter-spacing: 0.08em; }
.news-head a { font-size: 13px; text-decoration: none; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li {
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.news-list li:last-child { border-bottom: 0; }
.news-list a { color: var(--ink); text-decoration: none; flex: 1; }
.news-list a:hover { color: var(--navy); }
.news-list .news-ask { flex: 1; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
.news-list .news-ask:hover { color: var(--navy); text-decoration: underline; }
.news-list .news-more { flex: 0 0 auto; font-size: 13px; color: var(--navy); }
.hint-news { display: grid; gap: 6px; margin-top: 12px; text-align: left; }
.hint-news strong { font-size: 13px; color: var(--rose); }
.hint-news-item { font: inherit; font-size: 13px; text-align: left; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; }
.hint-news-item:hover { border-color: var(--navy); color: var(--navy); }
.news-tag {
  flex: none;
  font-size: 12px;
  color: var(--navy);
  border: 1px solid var(--navy);
  padding: 0 6px;
  line-height: 1.7;
}
.news-list time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.section { padding: 32px 0; }
.section h2 {
  margin: 0 0 6px;
  font-size: 26px;
  color: var(--rose);
  letter-spacing: 0.12em;
  font-weight: 700;
}
.section h2::after {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 8px;
  background: var(--rose);
}
.grid-3, .grid-4 { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card, .policy, .slip {
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px;
}
.card:hover, .policy:hover { border-color: #c9d4ea; }
.cat {
  margin: 0;
  color: var(--navy);
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.card h3, .policy h3, .slip h3 { margin: 8px 0 6px; font-size: 18px; letter-spacing: 0.04em; }
.card p, .policy p, .slip p { margin: 0 0 8px; color: var(--muted); }
.slip ol { margin: 8px 0 0; padding-left: 1.2em; }
.slip code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.row-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }

.site-foot {
  background: #f5f5f5;
  color: #585858;
  padding: 28px 0 22px;
  margin-top: 12px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: center;
}
.foot-info strong { display: block; letter-spacing: 0.08em; color: #333; margin-bottom: 6px; }
.foot-info p { margin: 0; letter-spacing: 0.06em; }
.foot-info a { color: #585858; }
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #ddd;
  font-weight: 700;
}
.foot-links a {
  color: #585858;
  text-decoration: none;
  padding: 0 16px;
  border-right: 2px solid #585858;
  line-height: 1;
}
.foot-links a:first-child { padding-left: 0; }
.foot-links a:last-child { border-right: 0; }
.foot-links a:hover { color: var(--navy); }

.launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d5d5d5;
  background: #fff;
  color: var(--navy);
  border-radius: 3px;
  padding: 8px 16px 8px 10px;
  box-shadow: var(--shadow);
  font-weight: 700;
  letter-spacing: 0.12em;
}
.launcher img { height: 28px; width: auto; display: block; }
body.chat-open .launcher { display: none; }

.widget {
  position: fixed;
  z-index: 35;
  right: 22px;
  bottom: 22px;
  width: min(392px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 36px));
  display: none;
  flex-direction: column;
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid #d5dbe8;
}
body.chat-open .widget { display: flex; }
.widget-head {
  background: #fff;
  color: var(--ink);
  padding: 12px 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 3px solid var(--navy);
}
/* logo 圖檔左邊留白很多，只取有圖的那一段。 */
.widget-logo { height: 34px; width: 82px; object-fit: cover; object-position: 84% 50%; display: block; flex: none; }
.widget-head > div:not(.head-tools) { flex: 1; min-width: 0; }
.head-tools { display: flex; flex: none; }
.icon-btn[hidden] { display: none; }
.icon-btn:disabled { opacity: 0.45; cursor: default; }
.widget-head strong { font-size: 16px; letter-spacing: 0.08em; }
.widget-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--navy);
  width: 34px;
  height: 34px;
  border-radius: 3px;
  text-decoration: none;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: #eef2fa; }
.mode-pill {
  display: inline-flex;
  margin-top: 6px;
  padding: 1px 8px;
  border-radius: 2px;
  background: #e8eef8;
  color: var(--navy);
  font-size: 12px;
}

.thread {
  flex: 1;
  overflow: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f7f8fb;
}
.empty-hint {
  margin: auto 8px;
  text-align: center;
  color: var(--muted);
}
.empty-hint strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; letter-spacing: 0.06em; }
.msg { max-width: 92%; display: flex; flex-direction: column; gap: 6px; }
.msg.user { align-self: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble {
  padding: 10px 12px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user .bubble { background: var(--navy); color: #fff; }
.msg.bot .bubble {
  background: #fff;
  border: 1px solid var(--line);
}
.bubble.typing { display: flex; gap: 5px; align-items: center; min-height: 26px; }
.bubble.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-dot 1.2s ease-in-out infinite;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) { .bubble.typing span { animation: none; opacity: 0.6; } }
.cites, .extra { display: flex; flex-wrap: wrap; gap: 6px; }
.cite, .tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 2px;
  background: #e8eef8;
  color: var(--navy-deep);
}
.tag.warn { background: #f8ebe6; color: #7a3e2e; }
.tag.ok { background: #e7f2ea; color: #1d6b3a; }
.receipt, .handoff-card {
  background: #fff;
  border: 1px dashed var(--rose);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 13px;
}
.receipt b, .handoff-card b { display: block; }
.handoff-card span { color: var(--muted); }
.handoff-card { border-style: solid; border-color: #e2b2a4; background: #fff8f5; }
.offer-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.offer-actions .chip { cursor: pointer; font-size: 14px; padding: 8px 12px; }
.offer-actions .chip.primary { background: var(--navy); border-color: var(--navy); color: #fff; }

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
  background: #f7f8fb;
}
.quick[hidden] { display: none; }
.quick button, .chip {
  border: 1px solid #c9d4ea;
  background: #fff;
  color: var(--navy);
  border-radius: 3px;
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 13px;
}
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.composer input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 3px;
  padding: 10px 12px;
}
.composer button[type="submit"] {
  border: 0;
  background: var(--navy);
  color: white;
  border-radius: 3px;
  height: 48px;
  padding: 0 16px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.composer button:disabled, .quick button:disabled { opacity: 0.55; cursor: wait; }
.composer .mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 56px;
  height: 56px;
  border: 0;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(49, 85, 164, 0.35);
  cursor: pointer;
}
.composer .mic svg { width: 28px; height: 28px; }
.composer .mic:hover:not(:disabled) { background: var(--navy-deep); }
.composer .mic[hidden] { display: none; }
.composer.listening input { border-color: #c62828; background: #fdf3f2; }
.composer.listening input::placeholder { color: #9b2c1f; opacity: 1; }
.speak-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: #e8eef8;
  color: var(--navy-deep);
  font-size: 13px;
}
.speak-bar[hidden] { display: none; }
.speak-bar button {
  border: 1px solid var(--navy);
  background: #fff;
  color: var(--navy);
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 13px;
}
.composer .mic.recording {
  background: #c62828;
  box-shadow: 0 4px 12px rgba(198, 40, 40, 0.4);
  color: white;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse { 50% { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .composer .mic.recording { animation: none; } }
.voice-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
}
.voice-pick[hidden] { display: none; }
.voice-pick select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 6px;
  background: white;
  font: inherit;
}
/* 服務語言：開場說明裡的二選一，和輸入框上方的語言列 */
.lang-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
}
.lang-choice strong { font-size: 14px; letter-spacing: 0.04em; margin: 0; }
.lang-choice small { color: var(--muted); font-size: 12px; }
.lang-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.lang-buttons button {
  border: 1px solid #c9d4ea;
  background: #fff;
  color: var(--navy);
  border-radius: 3px;
  padding: 6px 12px;
  font-size: 13px;
}
.lang-buttons button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.lang-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
}
.lang-bar[hidden] { display: none; }
.lang-bar[data-lang="taigi"] { background: #fff8e8; color: #6b4b00; border-top-color: #f0dca8; }
.lang-bar .link-btn { font-size: 13px; text-decoration: underline; padding: 0; }
.voice-note {
  align-self: center;
  margin: 4px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.legal {
  margin: 0;
  padding: 0 14px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}

/* 真人客服：專員的訊息、系統提示、等專員的狀態列、留聯絡方式的表單。 */
.msg.agent { align-self: flex-start; }
.msg.agent .who { font-size: 12px; color: #1d6b3a; font-weight: 700; letter-spacing: 0.08em; }
.msg.agent .bubble { background: #eef7f0; border: 1px solid #b9dcc3; }
.sys-note {
  align-self: center;
  max-width: 92%;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
}
.sys-note .link-btn { font-size: 13px; text-decoration: underline; padding: 0; }
.live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  background: #fff8e8;
  color: #6b4b00;
  border-top: 1px solid #f0dca8;
}
.live-bar[data-mode="human"] { background: #eef7f0; color: #1d6b3a; border-top-color: #b9dcc3; }
.live-bar[hidden] { display: none; }
.live-bar button {
  flex: none;
  border: 1px solid currentColor;
  background: #fff;
  color: inherit;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 13px;
}
.live-bar button[hidden] { display: none; }
.contact-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #fff;
  overflow-y: auto;
  padding: 18px 16px;
}
.contact-panel[hidden] { display: none; }
.contact-panel form { display: grid; gap: 12px; }
.contact-panel h3 { margin: 0; font-size: 18px; letter-spacing: 0.06em; }
.contact-panel p.muted { margin: 0; font-size: 13px; }
.contact-panel input:not([type="radio"]), .contact-panel select, .contact-panel textarea {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px;
  font: inherit;
  font-size: 16px;
  background: #fff;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}
.contact-panel .method { border: 0; padding: 0; margin: 0; display: block; }
.contact-panel .method legend { color: var(--muted); font-size: 14px; padding: 0; margin-bottom: 6px; }
.contact-panel .method label { display: inline-flex; gap: 6px; align-items: center; margin-right: 22px; font-size: 15px; white-space: nowrap; }
.contact-panel [data-for] { display: grid; gap: 12px; }
.contact-panel [data-for][hidden] { display: none; }
.feedback-panel .rating { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feedback-panel .rating legend { color: var(--muted); font-size: 14px; padding: 0; margin-bottom: 6px; }
.feedback-panel .rating label { position: relative; }
.feedback-panel .rating input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.feedback-panel .rating span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, inherit);
}
.feedback-panel .rating input:checked + span { border-color: var(--navy); background: #eef2fa; color: var(--navy); }
.feedback-panel .rating input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }
.legal .feedback-link { font-size: 11px; padding: 0; text-decoration: underline; }
.form-error { margin: 0; min-height: 1em; color: #9b2c1f; font-size: 13px; }
.contact-actions { display: flex; justify-content: flex-end; gap: 8px; }
.contact-actions button {
  height: 44px;
  padding: 0 18px;
  border-radius: 3px;
  border: 1px solid var(--navy);
  background: #fff;
  color: var(--navy);
  font-weight: 700;
}
.contact-actions button[type="submit"] { background: var(--navy); color: #fff; }
.contact-actions button:disabled { opacity: 0.55; }
.launcher.has-unread { background: #c62828; border-color: #c62828; color: #fff; }

body.page-embed { background: #f7f8fb; }
body.page-embed .widget {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100vh;
  border: 0;
  border-radius: 0;
  display: flex;
  box-shadow: none;
}
body.page-embed .launcher { display: none; }

.desk { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; background: #f7f8fb; }
.side {
  background: var(--navy-deep);
  color: #f4f7fc;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.side a { color: inherit; text-decoration: none; }
.side .brand { align-items: flex-start; flex-direction: column; }
.side .brand small { color: rgba(244, 247, 252, 0.72); }
.side .brand strong { color: #fff; }
.mark-logo {
  background: #fff;
  border-radius: 3px;
  padding: 6px 8px;
  display: inline-flex;
}
.mark-logo img { height: 32px; width: auto; display: block; }
.side nav { display: grid; gap: 6px; }
.side button, .side .tab {
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 3px;
  padding: 10px 12px;
}
.side .tab[aria-selected="true"], .side button:hover, .side .tab:hover {
  background: rgba(255, 255, 255, 0.1);
}
.side .spacer { flex: 1; }
.side .who-line { margin: 0; font-size: 13px; color: rgba(244, 247, 252, 0.82); line-height: 1.5; }
.side .who-line strong { color: #fff; display: block; }
.side .ghost {
  border: 1px solid rgba(244, 247, 252, 0.35);
  background: transparent;
  color: inherit;
  border-radius: 3px;
  padding: 8px 12px;
}
.main { padding: 22px 22px 40px; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 12px 0 16px; }
.stat {
  background: #fff;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
}
.stat b { display: block; font-size: 28px; line-height: 1.1; color: var(--navy); }
.stat span { color: var(--muted); font-size: 13px; }
/* 本月 AI 成本估算 */
.cost-box { background: #fff; border: 1px solid var(--line); padding: 14px 16px; margin: 0 0 16px; }
.cost-box:empty { display: none; }
.cost-head { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: flex-end; justify-content: space-between; }
.cost-title h2 { margin: 0 0 2px; font-size: 18px; }
.cost-title p { margin: 0; font-size: 13px; }
.cost-figures { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.cost-figure b { display: block; font-size: 20px; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.cost-figure.total b { font-size: 28px; color: var(--navy); }
.cost-figure span { color: var(--muted); font-size: 13px; }
.cost-box > .tag { display: inline-block; margin: 10px 0 0; }
.cost-box details { margin-top: 10px; }
.cost-box summary { cursor: pointer; color: var(--navy); font-size: 14px; }
.cost-box h3 { margin: 14px 0 4px; font-size: 14px; }
.cost-box table { margin-top: 8px; }
.cost-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.cost-line { margin: 0; padding: 0 0 6px; color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 12px; min-height: 520px; }
.pane {
  background: #fff;
  border: 1px solid var(--line);
  overflow: auto;
  max-height: calc(100vh - 210px);
}
.convo-btn, .ticket-row {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}
.convo-btn[aria-current="true"] { background: #e8eef8; }
.convo-btn small, .muted { color: var(--muted); }
.transcript { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.transcript .bubble { max-width: 100%; }
.bars { display: grid; gap: 10px; padding: 16px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 36px; gap: 8px; align-items: center; }
.track { height: 8px; background: #e6eaf2; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--navy); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: end; }
.hidden { display: none !important; }
.docs-grid { display: grid; grid-template-columns: 340px 1fr; gap: 12px; align-items: start; }
.upload-card { padding: 16px; display: grid; gap: 12px; }
.upload-card h2 { margin: 0; font-size: 20px; }
.upload-card p { margin: 0; font-size: 14px; }
.field { display: grid; gap: 4px; font-size: 14px; }
.field span { color: var(--muted); }
.field input[type="text"], .field input[type="password"], .field select {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  background: #fff;
  color: inherit;
  font: inherit;
}
.field input[type="file"] { font-size: 14px; max-width: 100%; }
.field textarea {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 160px;
}
.mode-switch { display: flex; gap: 16px; font-size: 14px; }
.mode-switch label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.btn {
  border: 0;
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  font-weight: 500;
}
.btn:hover { background: var(--navy-deep); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.index-line { padding: 12px 14px 0; margin: 0; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pad { padding: 0 14px 12px; margin: 12px 0 0; font-size: 14px; }
.actions { white-space: nowrap; }
.doc-checks { margin: 12px 14px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; font-size: 14px; }
.doc-checks h3 { margin: 0 0 8px; font-size: 15px; }
.doc-checks ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.doc-checks li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; line-height: 1.6; }
.doc-checks p { margin: 0; }
.link-btn { border: 0; background: transparent; color: var(--navy); padding: 0 6px; }
.link-btn.danger { color: #9b2c1f; }
.faq-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 16px 16px 0; }
.faq-head h2 { margin: 0; font-size: 20px; }
.faq-head p { margin: 4px 0 0; font-size: 13px; }
.faq-controls { display: flex; gap: 10px; align-items: flex-end; }
#faq-list { padding: 0 16px 16px; }
#faq-list > p { margin: 12px 0 0; font-size: 13px; }
.faq-list { margin: 12px 0 0; padding-left: 1.8em; }
.faq-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.faq-row strong { font-size: 16px; }
.faq-count { white-space: nowrap; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.faq-examples summary { cursor: pointer; font-size: 13px; margin-top: 4px; }
.faq-examples ul { margin: 6px 0 0; padding-left: 1.2em; font-size: 14px; color: var(--ink); }
.check-field { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.field input[type="date"] { border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px; background: #fff; color: inherit; font: inherit; }
.news-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.news-row.title-row { grid-template-columns: 1fr 84px; }
.news-row .field { min-width: 0; }
.news-row .field input, .news-row .field select { width: 100%; min-width: 0; box-sizing: border-box; }
.news-item .news-body { white-space: pre-wrap; color: var(--ink); }
.news-item.status-ended { opacity: 0.6; }
.news-item .actions { display: flex; gap: 4px; }
/* 客服帳號看不到新增表單時，清單佔滿整欄。 */
.docs-grid > .hidden + .docs-list { grid-column: 1 / -1; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-item { display: grid; gap: 4px; padding: 14px 16px; border-bottom: 1px solid var(--line); justify-items: start; }
.link-item:last-child { border-bottom: 0; }
.link-item .link-title { font-weight: 700; color: var(--navy); font-size: 16px; }
.link-item p { margin: 0; font-size: 14px; }
.inline-form { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.inline-form input { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 3px; min-width: 0; width: 180px; }
.doc-preview {
  margin: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--soft);
  white-space: pre-wrap;
  font-family: var(--sans);
  font-size: 14px;
  max-height: 360px;
  overflow: auto;
}
.doc-editor {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}
.docs-list tr.active td { background: var(--soft); }
.editor-head h2 { margin: 0; font-size: 18px; }
.editor-head p { margin: 4px 0 0; font-size: 13px; }
.editor-row { display: grid; grid-template-columns: 1fr 160px; gap: 12px; }
.doc-editor .field textarea { min-height: 320px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.editor-actions p { margin: 0; font-size: 14px; }
.editor-actions .ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  border-radius: 3px;
  padding: 10px 14px;
}
#panel-login { max-width: 420px; }

@media (max-width: 980px) {
  .hero, .grid-4, .grid-3, .row-2, .split, .stats, .desk, .foot-grid, .docs-grid { grid-template-columns: 1fr; }
  .desk { display: block; }
  .side { position: sticky; top: 0; z-index: 5; flex-direction: row; align-items: center; gap: 10px; overflow: auto; }
  .side .brand { flex-direction: row; align-items: center; }
  .side nav { display: flex; }
  .side .spacer, .side .brand small { display: none; }
  .pane { max-height: none; }
  .bar-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .head-row { min-height: 72px; flex-wrap: wrap; padding: 10px 0; }
  .logo-img { height: 40px; }
  .nav { width: 100%; gap: 12px 16px; flex-wrap: wrap; padding-bottom: 8px; }
  .topbar-inner { justify-content: flex-start; overflow: auto; }
  .foot-links a { padding: 6px 12px 6px 0; }
  .launcher { right: 12px; bottom: 12px; padding: 10px 14px; }
  .launcher img { display: none; }
  body.chat-open:not(.page-embed) .widget {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
  }
}
@media (min-width: 1100px) {
  /* 客服視窗開著時，內容讓出右邊 436px，並在剩下的寬度裡置中。 */
  body.chat-open .wrap {
    width: min(1120px, calc(100% - 460px));
    margin-left: max(24px, calc((100% - 436px - 1120px) / 2));
    margin-right: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* 後台：接手對話的狀態列與回覆框。 */
.live-box {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f8fb;
  font-size: 14px;
}
.live-box.mode-waiting { background: #fff8e8; border-color: #f0dca8; }
.live-box.mode-human { background: #eef7f0; border-color: #b9dcc3; }
.live-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.live-line .btn { padding: 8px 14px; }
.convo-btn .live-tag { display: inline-block; margin-bottom: 4px; }
.reply-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; position: sticky; bottom: 0; background: #fff; padding-top: 8px; }
.reply-form textarea {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px;
  font: inherit;
  resize: vertical;
  min-height: 64px;
}
.reply-form .reply-status { grid-column: 1 / -1; margin: 0; font-size: 13px; }
#panel-tickets td.mono, #panel-tickets td:nth-child(2), #panel-tickets th { white-space: nowrap; }

/* 問題標記 */
.flag-box { display: grid; gap: 4px; margin-top: 6px; padding: 8px 10px; border-left: 3px solid #b8572f; background: #fbf1ec; font-size: 13px; }
.flag-box.resolved { border-left-color: #1d6b3a; background: #eef6f0; }
.flag-box .flag-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.flag-form { display: grid; gap: 8px; margin-top: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; max-width: 520px; }
.flag-form textarea { min-height: 64px; }
.flag-form .flag-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flag-form .flag-buttons .muted { margin: 0; font-size: 13px; }
.flag-btn { font-size: 13px; color: var(--muted); }
.list-filter { display: flex; gap: 8px; align-items: center; font-size: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
#panel-flags table { margin: 0 16px 16px; width: calc(100% - 32px); }
#panel-flags td { vertical-align: top; }
#panel-flags th, #panel-flags td.nowrap, #panel-flags td.actions { white-space: nowrap; }
#panel-flags .clip { max-width: 320px; white-space: pre-wrap; }
#flags-line { padding: 0 16px; }

/* 後台：客人對對話的回饋。 */
.feedback-box { border: 1px solid #b9dcc3; background: #eef7f0; border-radius: 3px; padding: 10px 12px; margin-bottom: 10px; }
.feedback-box.warn { border-color: #f0dca8; background: #fff8e8; }
.feedback-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.feedback-head small { color: var(--muted); }
.feedback-box p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
