/*! 品牌增長小秘書 | 三區分色：聊天（淡灰藍）、快捷（深色底＋白卡）、輸入（白）。對比度見 docs/11 第 8 節 */
.m88a{
  --a-ink:#1D1D1F;--a-muted:#4F5761;--a-btn:#C2461A;--a-btn-h:#A93C10;--a-link:#B8430F;
  --a-chat:#E8EDF4;--a-edge:#C7CFDA;--a-line:#86868B;--a-dark:#1D1D1F;--a-dark-2:#2C2C2E;--a-on-dark:#FF8A4C;--a-on-dark-muted:#C7C7CC;
  --a-r:18px;--a-shadow:0 24px 60px rgba(17,17,26,.22),0 2px 8px rgba(17,17,26,.08);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro TC","PingFang TC","Noto Sans TC","Microsoft JhengHei",sans-serif;
  color:var(--a-ink);font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased}
.m88a *,.m88a *::before,.m88a *::after{box-sizing:border-box}
.m88a [hidden]{display:none !important}
.m88a button,.m88a textarea{font:inherit;color:inherit}
.m88a button{-webkit-tap-highlight-color:transparent}
.m88a :focus-visible{outline:3px solid var(--a-link);outline-offset:2px}
.m88a-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.m88a-ico{width:18px;height:18px;flex:none}

/* ---------- 頭像 ---------- */
.m88a-avatar{flex:none;display:inline-grid;place-items:center;width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,#D4501C,#A93C10);color:#fff;box-shadow:inset 0 0 0 2px rgba(255,255,255,.25)}
.m88a-avatar .m88a-ico{width:20px;height:20px}
.m88a-avatar.is-sm{width:34px;height:34px}
.m88a-avatar.is-xs{width:26px;height:26px;margin-top:2px}
.m88a-avatar.is-xs .m88a-ico{width:14px;height:14px}

/* ---------- 浮動按鈕 ---------- */
.m88a-fab{position:fixed;right:20px;bottom:calc(20px + env(safe-area-inset-bottom));z-index:95;display:flex;align-items:center;gap:8px;min-height:52px;padding:0 20px 0 16px;border:0;border-radius:999px;background:var(--a-btn);color:#fff !important;font-weight:700;font-size:16px;letter-spacing:.02em;box-shadow:0 10px 28px rgba(194,70,26,.35),0 2px 6px rgba(0,0,0,.12);cursor:pointer;transition:transform .2s ease,background-color .2s ease}
.m88a-fab:hover{background:var(--a-btn-h);transform:translateY(-2px)}
.m88a-fab .m88a-fab-ico{width:22px;height:22px}
html.m88a-open .m88a-fab{display:none}

/* ---------- 問候卡 ---------- */
.m88a-greet{position:fixed;right:20px;bottom:calc(86px + env(safe-area-inset-bottom));z-index:95;display:flex;align-items:flex-start;width:320px;max-width:calc(100vw - 24px);background:#fff;border:1px solid #D2D2D7;border-radius:16px;box-shadow:0 16px 40px rgba(17,17,26,.16);animation:m88a-rise .35s ease both}
.m88a-greet::after{content:"";position:absolute;right:34px;bottom:-7px;width:14px;height:14px;background:#fff;border-right:1px solid #D2D2D7;border-bottom:1px solid #D2D2D7;transform:rotate(45deg)}
.m88a-greet-open{flex:1;display:flex;gap:10px;align-items:flex-start;text-align:left;padding:14px 4px 14px 14px;border:0;background:none;cursor:pointer;border-radius:16px}
.m88a-greet-t strong{display:block;font-size:15px;line-height:1.35;margin-bottom:3px;color:var(--a-ink)}
.m88a-greet-t span{display:block;font-size:14px;line-height:1.45;color:var(--a-muted)}
.m88a-greet-x{flex:none;min-width:40px;min-height:40px;margin:4px 4px 0 0;border:0;border-radius:10px;background:none;font-size:22px;line-height:1;color:var(--a-muted);cursor:pointer}
.m88a-greet-x:hover{background:#F2F2F5}

/* ---------- 對話框 ---------- */
.m88a-panel{position:fixed;right:20px;bottom:calc(20px + env(safe-area-inset-bottom));z-index:96;display:flex;flex-direction:column;width:400px;max-width:calc(100vw - 24px);height:min(660px,calc(100vh - 40px));background:#fff;border:1px solid #D2D2D7;border-radius:var(--a-r);box-shadow:var(--a-shadow);overflow:hidden}
.m88a-panel.is-in{animation:m88a-rise .28s cubic-bezier(.2,.8,.2,1) both}
@keyframes m88a-rise{from{opacity:0;transform:translateY(12px) scale(.98)}to{opacity:1;transform:none}}

.m88a-head{flex:none;display:flex;align-items:center;gap:10px;padding:12px 10px 12px 14px;background:#fff;border-bottom:1px solid #D2D2D7}
.m88a-head-t{flex:1;min-width:0}
.m88a-head h2{margin:0;font-size:16px;font-weight:700;line-height:1.3;color:var(--a-ink)}
.m88a-head p{margin:1px 0 0;font-size:13px;line-height:1.4;color:var(--a-muted)}
.m88a-head-b{display:flex;gap:4px;flex:none}
.m88a-hbtn{display:inline-flex;align-items:center;gap:4px;min-height:40px;min-width:40px;padding:0 10px;border:1px solid #D2D2D7;border-radius:10px;background:#fff;font-size:14px;cursor:pointer;justify-content:center}
.m88a-hbtn:hover{background:#F5F5F7}
.m88a-hbtn .m88a-ico{width:16px;height:16px}
.m88a-hbtn.is-icon{padding:0}

/* ---------- 聊天區（淡灰藍） ---------- */
.m88a-log{flex:1;min-height:120px;overflow-y:auto;padding:16px 12px 8px;background:var(--a-chat);overscroll-behavior:contain;scroll-behavior:smooth}
.m88a-row{display:flex;gap:8px;align-items:flex-start;margin:0 0 12px}
.m88a-row.is-u{justify-content:flex-end}
.m88a-msg{max-width:84%;padding:9px 13px;border-radius:16px;word-break:break-word}
.m88a-msg p{margin:0;white-space:pre-wrap}
.m88a-row.is-a .m88a-msg{background:#fff;border:1px solid var(--a-edge);border-top-left-radius:6px;box-shadow:0 1px 2px rgba(17,17,26,.05)}
.m88a-row.is-u .m88a-msg{background:var(--a-btn);color:#fff;border-top-right-radius:6px}
.m88a-tag{display:inline-block;margin-bottom:4px;padding:0 8px;border-radius:999px;background:#EEF1F5;font-size:12px;font-weight:600;line-height:20px;color:var(--a-muted)}
.m88a-tag.is-ai{background:#F3ECF8;color:#5E2D85}
.m88a-src{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:10px;padding-top:8px;border-top:1px dashed var(--a-edge)}
.m88a-src-h{flex-basis:100%;font-size:12px;font-weight:600;color:var(--a-muted)}
.m88a-src a{display:inline-flex;align-items:center;gap:4px;min-height:32px;padding:4px 12px;border:1px solid var(--a-link);border-radius:999px;color:var(--a-link);font-size:14px;line-height:1.3;text-decoration:none}
.m88a-src a:hover{background:#FFF2EC}
.m88a-src a .m88a-ico{width:13px;height:13px}
.m88a-sys{margin:4px auto 12px;max-width:92%;padding:6px 12px;border-radius:10px;background:rgba(255,255,255,.7);font-size:14px;color:var(--a-muted);text-align:center}
.m88a-retry{margin-left:8px;min-height:32px;padding:0 12px;border:1px solid var(--a-btn);border-radius:8px;background:#fff;color:var(--a-link) !important;font-weight:600;cursor:pointer}
.m88a-dots{display:inline-flex;gap:5px;padding:6px 2px}
.m88a-dots i{width:7px;height:7px;border-radius:50%;background:#737B86;animation:m88a-dot 1.2s infinite ease-in-out}
.m88a-dots i:nth-child(2){animation-delay:.15s}.m88a-dots i:nth-child(3){animation-delay:.3s}
@keyframes m88a-dot{0%,80%,100%{opacity:.35;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}

/* ---------- 快捷區（深色底＋白卡） ---------- */
.m88a-quick{flex:none;display:flex;flex-direction:column;gap:8px;padding:10px 12px 12px;background:var(--a-dark)}
.m88a-qh{margin:0;font-size:13px;font-weight:600;color:var(--a-on-dark-muted);letter-spacing:.04em}
.m88a-chips{display:flex;flex-direction:column;gap:6px}
.m88a-chip{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:42px;padding:8px 12px 8px 14px;border:0;border-radius:12px;background:#fff;color:var(--a-ink) !important;font-size:15px;line-height:1.35;text-align:left;cursor:pointer;transition:background-color .15s ease,transform .15s ease}
.m88a-chip:hover{background:#FFF2EC}
.m88a-chip:active{transform:scale(.99)}
.m88a-chip .m88a-chip-ico{width:16px;height:16px;color:var(--a-link)}
.m88a-chip:disabled{opacity:.55;cursor:not-allowed}
.m88a-act{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.m88a-cta{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:42px;padding:0 16px;border:0;border-radius:12px;background:var(--a-on-dark);color:var(--a-ink) !important;font-size:15px;font-weight:700;cursor:pointer}
.m88a-quick .m88a-cta{flex:1}
.m88a-cta:hover{background:#FFA06C}
.m88a-cta.is-pulse{animation:m88a-pulse 1.2s ease 2}
@keyframes m88a-pulse{50%{box-shadow:0 0 0 6px rgba(255,138,76,.4)}}
.m88a-line{display:inline-flex;align-items:center;gap:6px;min-height:42px;padding:0 4px;color:#fff;font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:3px}
.m88a-line .m88a-ico{width:18px;height:18px;color:#06C755}
.m88a-quick :focus-visible{outline-color:var(--a-on-dark)}

/* ---------- 輸入區（白） ---------- */
.m88a-form{flex:none;padding:10px 12px 8px;background:#fff;border-top:1px solid #D2D2D7}
.m88a-inbox{display:flex;gap:6px;align-items:flex-end;padding:4px 4px 4px 12px;border:1px solid var(--a-line);border-radius:16px;background:#fff}
.m88a-inbox:focus-within{border-color:var(--a-link);box-shadow:0 0 0 3px rgba(184,67,15,.18)}
.m88a-text{flex:1;min-height:40px;max-height:112px;padding:8px 0;border:0;background:transparent;font-size:16px;line-height:1.45;resize:none;outline:none}
.m88a .m88a-text:focus-visible{outline:none}
.m88a-send{flex:none;display:inline-flex;align-items:center;gap:4px;min-height:40px;padding:0 14px;border:0;border-radius:12px;background:var(--a-btn);color:#fff !important;font-weight:600;cursor:pointer}
.m88a-send .m88a-ico{width:16px;height:16px}
.m88a-send:hover{background:var(--a-btn-h)}
.m88a-send:disabled{background:#8E8E93;cursor:not-allowed}
.m88a-count{display:block;min-height:0;font-size:12px;color:var(--a-muted);text-align:right}
.m88a-count:empty{display:none}
.m88a-note{margin:6px 2px 0;font-size:13px;line-height:1.45;color:var(--a-muted)}
.m88a-note a{color:var(--a-link);margin-left:4px;white-space:nowrap}

/* ---------- 需求摘要 ---------- */
.m88a-sum{flex:1;overflow-y:auto;padding:14px;background:var(--a-chat)}
.m88a-steps{display:flex;gap:6px;margin:0 0 12px;padding:0;list-style:none;counter-reset:s}
.m88a-steps li{flex:1;display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:10px;background:rgba(255,255,255,.6);font-size:13px;color:var(--a-muted);counter-increment:s}
.m88a-steps li::before{content:counter(s);display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:#fff;border:1px solid var(--a-edge);font-size:12px;font-weight:700}
.m88a-steps li.is-on{background:#fff;color:var(--a-ink);font-weight:600}
.m88a-steps li.is-on::before{background:var(--a-btn);border-color:var(--a-btn);color:#fff}
.m88a-sum-l{display:block;font-weight:700;margin-bottom:6px}
.m88a-sumtext{width:100%;min-height:180px;padding:12px;border:1px solid var(--a-line);border-radius:14px;background:#fff;font-size:16px;line-height:1.55}
.m88a-sum-h{margin:8px 0 0;font-size:13px;line-height:1.5;color:var(--a-muted)}
.m88a-sum-st{margin:8px 0 0;font-size:14px}
.m88a-sum-st:empty{display:none}
.m88a-sum-st.is-err{color:#A61B1B}
.m88a-sum-st.is-ok{color:#1B6B35}
.m88a-sum-b{margin-top:12px}
.m88a-sum .m88a-cta.is-primary{width:100%;min-height:48px;background:var(--a-btn);color:#fff !important;font-size:16px}
.m88a-sum .m88a-cta.is-primary:hover{background:var(--a-btn-h)}
.m88a-sum-b2{display:flex;gap:8px;margin-top:8px}
.m88a-sec{flex:1;min-height:42px;padding:0 14px;border:1px solid var(--a-line);border-radius:12px;background:#fff;cursor:pointer}
.m88a-sec:hover{background:#F5F5F7}

/* ---------- 手機 ---------- */
@media (max-width:600px){
  .m88a-fab{right:12px;bottom:calc(12px + env(safe-area-inset-bottom));min-height:48px;padding:0 16px 0 13px;font-size:15px}
  .has-m-cta .m88a-fab{bottom:calc(80px + env(safe-area-inset-bottom))}
  .m88a-greet{right:12px;left:12px;width:auto;max-width:none;bottom:calc(72px + env(safe-area-inset-bottom))}
  .has-m-cta .m88a-greet{bottom:calc(140px + env(safe-area-inset-bottom))}
  .m88a-panel{right:0;left:0;bottom:0;width:100%;max-width:none;height:calc(var(--m88a-vh,100vh) - 8px);max-height:calc(100dvh - 8px);border-radius:18px 18px 0 0;border-left:0;border-right:0;border-bottom:0}
  .m88a-form{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
  html.m88a-open .m-cta{display:none !important}
}
/* 矮螢幕（小手機、鍵盤開啟）：快捷選項改為單列橫向滑動，保留對話區高度，字級不縮小 */
@media (max-height:740px){
  .m88a-qh{display:none}
  .m88a-chips{flex-direction:row;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -12px;padding:0 12px;scroll-snap-type:x proximity}
  .m88a-chips::-webkit-scrollbar{display:none}
  .m88a-chips .m88a-chip{flex:0 0 auto;white-space:nowrap;scroll-snap-align:start}
  .m88a-chips .m88a-chip .m88a-chip-ico{display:none}
  .m88a-quick{padding-top:10px;padding-bottom:10px}
}
@media (max-width:360px){
  .m88a-head{gap:8px;padding-left:10px}
  .m88a-head .m88a-avatar{width:32px;height:32px}
  .m88a-hbtn{padding:0 8px}
  .m88a-head p{font-size:12.5px}
  .m88a-send span{display:none}
  .m88a-send{padding:0 12px}
  .m88a-act{gap:8px}
  .m88a-quick .m88a-cta{padding:0 10px;white-space:nowrap;font-size:14.5px}
  .m88a-line{font-size:13.5px;white-space:nowrap}
}
@media (prefers-reduced-motion:reduce){
  .m88a-panel.is-in,.m88a-greet,.m88a-cta.is-pulse,.m88a-dots i{animation:none}
  .m88a-fab,.m88a-chip{transition:none}
  .m88a-log{scroll-behavior:auto}
}
@media print{.m88a{display:none}}
