/* AI 客服概念展示 (js/demos/cs.js) — 虛構店家「小島咖啡」，360×760 */

.device-screen[data-demo="cs"] { --status: #fff; }

.dm-cs {
  position: absolute;
  inset: 0;
  z-index: 0;
  isolation: isolate;
  overflow: hidden;
  background: #eef1ee;
  color: #1f2d29;
  font-family: "Noto Sans TC", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-align: left;
}
.dm-cs *,
.dm-cs *::before,
.dm-cs *::after { box-sizing: border-box; }
.dm-cs svg { display: block; flex: none; }
.dm-cs.cs-instant,
.dm-cs.cs-instant * { transition: none !important; }

/* Header (also used by the admin view) */
.dm-cs .cs-head {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 0;
  height: 106px;
  padding: 48px 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2f4a43;
  color: #fff;
  box-shadow: 0 2px 12px rgba(20, 40, 34, 0.18);
}
.dm-cs .cs-ico {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: none;
  opacity: 0.92;
}
.dm-cs .cs-av {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: #c8875a;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}
.dm-cs .cs-av-badge {
  position: absolute;
  right: -4px;
  bottom: -2px;
  padding: 2px 3px;
  border-radius: 6px;
  background: #fff;
  color: #2f4a43;
  font: 700 8px/1 "Syne", "Noto Sans TC", sans-serif;
  letter-spacing: 0.04em;
}
.dm-cs .cs-title {
  flex: 1;
  min-width: 0;
  display: grid;
  margin-left: 4px;
  line-height: 1.3;
}
.dm-cs .cs-title b { font-size: 16px; font-weight: 600; }
.dm-cs .cs-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.74);
  white-space: nowrap;
}
.dm-cs .cs-sub i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7fd3a0;
  transition: background 0.3s;
}
.dm-cs .cs-sub.is-human i { background: #f2c26b; }
.dm-cs .cs-pill {
  margin-right: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  white-space: nowrap;
}

/* Chat feed: rows anchored to the bottom, each row expands in */
.dm-cs .cs-chat { position: absolute; inset: 0; }
.dm-cs .cs-feed {
  position: absolute;
  left: 0;
  right: 0;
  top: 106px;
  bottom: 128px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 0 12px 4px;
}
.dm-cs .cs-row {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(10px);
  transition:
    grid-template-rows 0.42s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.3s ease,
    transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dm-cs .cs-row.is-in { grid-template-rows: 1fr; opacity: 1; transform: none; }
.dm-cs .cs-clip { min-height: 0; overflow: hidden; }
.dm-cs .cs-pad { padding: 5px 0; }

.dm-cs .cs-me {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 6px;
}
.dm-cs .cs-bot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.dm-cs .cs-col { display: grid; justify-items: start; min-width: 0; }
.dm-cs .cs-av-sm {
  width: 30px;
  height: 30px;
  box-shadow: none;
}
.dm-cs .cs-av-gap { width: 30px; flex: none; }
.dm-cs .cs-av-amy { background: none; box-shadow: none; overflow: hidden; }
.dm-cs .cs-name {
  margin: 0 0 2px 3px;
  font-size: 11px;
  color: #6f7f79;
}
.dm-cs .cs-name b { color: #a8683e; font-weight: 600; }
.dm-cs .cs-bubble {
  max-width: 246px;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: 0 1px 2px rgba(31, 45, 41, 0.07);
  overflow-wrap: anywhere;
}
.dm-cs .cs-bubble--me { background: #d8efe2; border-bottom-right-radius: 6px; }
.dm-cs .cs-bubble--bot { background: #fff; border-top-left-radius: 6px; }
.dm-cs .cs-time {
  align-self: flex-end;
  padding-bottom: 2px;
  font-size: 10.5px;
  color: #8a9893;
  white-space: nowrap;
}
.dm-cs .cs-src {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 0 4px;
  font-size: 10.5px;
  color: #8a9893;
}
.dm-cs .cs-dots { display: flex; gap: 4px; padding: 5px 2px; }
.dm-cs .cs-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a3b0ab;
  animation: cs-dot 1.1s ease-in-out infinite;
}
.dm-cs .cs-dots i:nth-child(2) { animation-delay: 0.15s; }
.dm-cs .cs-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes cs-dot {
  0%, 60%, 100% { transform: none; opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.dm-cs .cs-date,
.dm-cs .cs-sys { display: flex; justify-content: center; }
.dm-cs .cs-date span {
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(47, 74, 67, 0.08);
  font-size: 11px;
  color: #6f7f79;
}
.dm-cs .cs-sys span {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 12px;
  border: 1px solid #ecd6c1;
  background: #f8ece0;
  font-size: 12px;
  color: #6b5440;
}

/* Product card */
.dm-cs .cs-card {
  width: 232px;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(31, 45, 41, 0.09);
}
.dm-cs .cs-art {
  position: relative;
  height: 112px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 1.4px, transparent 1.9px) 4px 6px / 26px 26px,
    radial-gradient(circle, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.5px) 15px 18px / 26px 26px,
    linear-gradient(160deg, #f8ebdb, #efd5ba);
}
.dm-cs .cs-art-tag {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 2px 8px;
  border-radius: 9px;
  background: #2f4a43;
  color: #fff;
  font-size: 10.5px;
}
.dm-cs .cs-card-body { padding: 10px 13px 12px; }
.dm-cs .cs-card-title { font-size: 15px; font-weight: 600; }
.dm-cs .cs-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}
.dm-cs .cs-price { font-size: 16.5px; font-weight: 700; color: #b5703f; }
.dm-cs .cs-stock {
  padding: 1px 8px;
  border-radius: 10px;
  background: #fbe6e1;
  color: #b14a3a;
  font-size: 11.5px;
}
.dm-cs .cs-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.dm-cs .cs-btn {
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.dm-cs .cs-btn--line { border: 1px solid #dcc6b3; color: #8a5a3b; }
.dm-cs .cs-btn--fill {
  background: #c8875a;
  color: #fff;
  transition: background 0.25s, transform 0.15s;
}
.dm-cs .cs-btn--fill.is-done { background: #3f8a5a; }
.dm-cs .cs-btn--sm {
  display: inline-grid;
  height: 32px;
  padding: 0 14px;
  border-radius: 9px;
}

/* Order card */
.dm-cs .cs-order {
  width: 246px;
  padding: 12px 14px 4px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(31, 45, 41, 0.09);
}
.dm-cs .cs-order-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.dm-cs .cs-order-head b { font-size: 14.5px; font-weight: 700; letter-spacing: 0.02em; }
.dm-cs .cs-order-head span { font-size: 11px; color: #8a9893; }
.dm-cs .cs-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
  font-size: 12.5px;
}
.dm-cs .cs-thumb {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.dm-cs .cs-thumb--gift { background: linear-gradient(150deg, #c9554a, #a03c33); }
.dm-cs .cs-thumb--drip { background: linear-gradient(150deg, #b98e66, #8a6142); }
.dm-cs .cs-item em { font-style: normal; color: #6f7f79; font-size: 12px; font-variant-numeric: tabular-nums; }
.dm-cs .cs-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed #dfe5e2;
  font-size: 13px;
}
.dm-cs .cs-total b { font-weight: 700; }
.dm-cs .cs-free {
  padding: 1px 8px;
  border-radius: 9px;
  background: #e3f2e8;
  color: #3f8a5a;
  font-size: 11px;
}
.dm-cs .cs-tl { margin-top: 12px; }
.dm-cs .cs-step {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 10px;
  padding-bottom: 10px;
}
.dm-cs .cs-step::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
  background: #e3e8e5;
  transition: background 0.4s;
}
.dm-cs .cs-step:last-child::before { display: none; }
.dm-cs .cs-step.is-done::before { background: #3f8a5a; }
.dm-cs .cs-node {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e3e8e5;
  color: #fff;
  transform: scale(0.7);
  transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.3s;
}
.dm-cs .cs-node svg { opacity: 0; transition: opacity 0.2s; }
.dm-cs .cs-step.is-done .cs-node { background: #3f8a5a; transform: none; }
.dm-cs .cs-step.is-done .cs-node svg { opacity: 1; }
.dm-cs .cs-step.is-now .cs-node {
  background: #c8875a;
  transform: none;
  animation: cs-ring 1.6s ease-out infinite;
}
.dm-cs .cs-step.is-now .cs-node::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}
@keyframes cs-ring {
  0% { box-shadow: 0 0 0 0 rgba(200, 135, 90, 0.5); }
  100% { box-shadow: 0 0 0 9px rgba(200, 135, 90, 0); }
}
.dm-cs .cs-step b { display: block; font-size: 13px; font-weight: 600; line-height: 20px; color: #9aa6a2; transition: color 0.3s; }
.dm-cs .cs-step.is-done b,
.dm-cs .cs-step.is-now b { color: #1f2d29; }
.dm-cs .cs-step span { display: block; font-size: 11.5px; color: #8a9893; }

/* Photo bubble + handoff summary */
.dm-cs .cs-photo {
  width: 176px;
  height: 128px;
  border-radius: 16px;
  border-bottom-right-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(31, 45, 41, 0.12);
}
.dm-cs .cs-sum {
  width: 236px;
  padding: 11px 13px 12px;
  border-radius: 16px;
  border: 1px solid #ecd6c1;
  background: #fff;
}
.dm-cs .cs-sum-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #8a5a3b;
}
.dm-cs .cs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dm-cs .cs-tag {
  padding: 3px 9px;
  border-radius: 10px;
  background: #f1f3f1;
  color: #33443f;
  font-size: 12px;
  opacity: 0;
  transform: translateY(4px) scale(0.94);
  transition: opacity 0.3s, transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.dm-cs .cs-tag.is-in { opacity: 1; transform: none; }
.dm-cs .cs-tag--hot { background: #fbe6e1; color: #b14a3a; }

/* Quick replies + input bar */
.dm-cs .cs-quick {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 82px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent);
  mask-image: linear-gradient(90deg, #000 84%, transparent);
}
.dm-cs .cs-chip {
  flex: none;
  padding: 6px 13px;
  border-radius: 16px;
  border: 1px solid rgba(200, 135, 90, 0.5);
  background: #fff;
  color: #a8683e;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s, background 0.2s, color 0.2s;
}
.dm-cs .cs-chip.is-press { transform: scale(0.94); background: #c8875a; color: #fff; }
.dm-cs .cs-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 82px;
  padding: 10px 12px 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-top: 1px solid #e1e6e3;
}
.dm-cs .cs-plus { color: #7d8b86; }
.dm-cs .cs-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  background: #f1f3f1;
  font-size: 14.5px;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s;
}
.dm-cs .cs-input.is-focus { border-color: #c8875a; background: #fff; }
.dm-cs .cs-ph { color: #9aa6a2; }
.dm-cs .cs-input.has-text .cs-ph { display: none; }
.dm-cs .cs-clipx { flex: 1; min-width: 0; overflow: hidden; }
.dm-cs .cs-text { display: inline-block; }
.dm-cs .cs-input:not(.has-text) .cs-clipx { flex: 0; }
.dm-cs .cs-send {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dfe5e2;
  color: #fff;
  transition: background 0.2s;
}
.dm-cs .cs-send.is-on { background: #c8875a; }

.dm-cs .cs-toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 20px;
  background: rgba(31, 45, 41, 0.93);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dm-cs .cs-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.dm-cs .cs-toast--chat { top: 118px; transform: translate(-50%, -12px); }
.dm-cs .cs-toast--chat.is-on { transform: translate(-50%, 0); }
.dm-cs .cs-toast--adm { bottom: 40px; }
.dm-cs .cs-toast svg { color: #9fe0b8; }

/* Admin view */
.dm-cs .cs-admin {
  position: absolute;
  z-index: 8;
  inset: 0;
  background: #f3f5f3;
  opacity: 0;
  visibility: hidden;
  transform: translateX(28px);
  transition: opacity 0.35s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.5s;
}
.dm-cs[data-view="admin"] .cs-admin {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.dm-cs .cs-adm-body {
  position: absolute;
  left: 0;
  right: 0;
  top: 106px;
  bottom: 0;
  overflow: hidden;
}
.dm-cs .cs-adm-scroll {
  padding: 14px 14px 30px;
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dm-cs .cs-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dm-cs .cs-stat {
  display: grid;
  gap: 1px;
  padding: 11px 13px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 45, 41, 0.06);
}
.dm-cs .cs-stat span { font-size: 12px; color: #6b7a75; }
.dm-cs .cs-stat b {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.dm-cs .cs-stat em { font-style: normal; font-size: 11px; color: #3f8a5a; }
.dm-cs .cs-stat em.is-muted { color: #8a9893; }
.dm-cs .cs-stat--hl { background: #2f4a43; color: #fff; }
.dm-cs .cs-stat--hl span { color: rgba(255, 255, 255, 0.72); }
.dm-cs .cs-stat--hl em { color: #9fe0b8; }
.dm-cs .cs-panel {
  margin-top: 12px;
  padding: 13px 14px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 45, 41, 0.06);
}
.dm-cs .cs-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.dm-cs .cs-panel-head b { font-size: 14.5px; font-weight: 600; }
.dm-cs .cs-panel-head span { font-size: 11.5px; color: #8a9893; }
.dm-cs .cs-q { padding: 5px 0; }
.dm-cs .cs-q-top { display: flex; justify-content: space-between; font-size: 13px; }
.dm-cs .cs-q-top b { font-weight: 600; color: #33443f; font-variant-numeric: tabular-nums; }
.dm-cs .cs-q-bar {
  height: 6px;
  margin-top: 5px;
  border-radius: 3px;
  background: #eef1ee;
  overflow: hidden;
}
.dm-cs .cs-q-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #e2b08b, #c8875a);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dm-cs .cs-q.is-in .cs-q-bar i { transform: scaleX(var(--w, 1)); }
.dm-cs .cs-badge {
  min-width: 20px;
  padding: 0 7px;
  border-radius: 9px;
  background: #d0674f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.dm-cs .cs-fix-q { font-size: 14px; font-weight: 600; }
.dm-cs .cs-fix-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: #a8683e;
  transition: color 0.3s;
}
.dm-cs .cs-fix-meta i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0a33f;
  transition: background 0.3s;
}
.dm-cs .cs-fix.is-done .cs-fix-meta { color: #3f8a5a; }
.dm-cs .cs-fix.is-done .cs-fix-meta i { background: #3f8a5a; }
.dm-cs .cs-fix-act { display: flex; gap: 8px; margin-top: 10px; }
.dm-cs .cs-fix-act .cs-btn--line { height: 32px; padding: 0 14px; border-radius: 9px; display: inline-grid; }
.dm-cs .cs-editor {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dm-cs .cs-fix.is-open .cs-editor { grid-template-rows: 1fr; }
.dm-cs .cs-editor-in { min-height: 0; overflow: hidden; }
.dm-cs .cs-editor-label { margin-top: 12px; font-size: 11.5px; color: #8a9893; }
.dm-cs .cs-editor-box {
  min-height: 74px;
  margin-top: 5px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1.5px solid #c8875a;
  background: #fffaf5;
  font-size: 13.5px;
  line-height: 1.6;
}
.dm-cs .cs-editor-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding-bottom: 2px;
}
