/* ra2b 服務台：配色與字型沿用 SSO 登入頁（keycloak-theme/rabbit-village） */
:root {
  --bg: #f6f0e7;
  --bg-glow: #fbf7f1;
  --card: #fffdf9;
  --tint: #f7efe6;
  --ink: #382e29;
  --ink-soft: #5c4b42;
  --muted: #8a766b;
  --line: #e7dbcf;
  --line-strong: #d6c5b6;
  --primary: #a8482e;
  --primary-hover: #923c25;
  --primary-press: #7d321e;
  --primary-soft: #f6e5dc;
  --ring: rgba(168, 72, 46, 0.18);
  --danger: #b33e34;
  --danger-bg: #fbece8;
  --success: #3d704a;
  --success-bg: #edf4e9;
  --warn: #93600f;
  --warn-bg: #fbf0dc;
  --info: #3f5f7f;
  --info-bg: #e9eff5;
  --radius-field: 14px;
  /* 立體感：四層陰影（跟後台同一套），越重要浮得越高；陰影用暖棕色配米色底 */
  --e1: 0 1px 2px rgba(56, 46, 41, 0.06), 0 2px 6px rgba(56, 46, 41, 0.05);
  --e2: 0 2px 4px rgba(56, 46, 41, 0.06), 0 8px 20px rgba(56, 46, 41, 0.08);
  --e3: 0 4px 8px rgba(56, 46, 41, 0.07), 0 16px 36px rgba(56, 46, 41, 0.12);
  --e4: 0 12px 24px rgba(56, 46, 41, 0.12), 0 30px 70px rgba(56, 46, 41, 0.2);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --well: inset 0 1px 2px rgba(56, 46, 41, 0.07);
  --glow-primary: 0 2px 4px rgba(168, 72, 46, 0.16), 0 8px 18px rgba(168, 72, 46, 0.24);
  --sans: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar: 60px;
}

/* 简中介面改用簡體字形 */
:root:lang(zh-Hans) {
  --sans: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "Source Han Serif SC", Georgia, serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1100px 520px at 50% -8%, var(--bg-glow), transparent 70%), var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

img { display: block; max-width: 100%; }

h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: 0.01em; color: var(--ink); }

p { margin: 0; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.icon { flex: none; }

/* ------------------------------------------------------------ top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  background: rgba(246, 240, 231, 0.86);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 20px -16px rgba(56, 46, 41, 0.35);
}

.topbar-inner { display: flex; align-items: center; gap: 10px; max-width: 1080px; height: 100%; margin: 0 auto; padding: 0 16px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }

/* 兔子標誌＋思考泡泡：泡泡超出右上角，所以右邊留空間 */
.mark { position: relative; display: inline-block; flex: none; width: var(--mark); height: var(--mark); margin-right: calc(var(--mark) * 0.3); }
.mark img { width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(56, 46, 41, 0.18)); }
.mark-bubble { position: absolute; left: calc(var(--mark) * 0.68); top: calc(var(--mark) * -0.2); width: calc(var(--mark) * 0.62); overflow: visible; filter: drop-shadow(0 1px 2px rgba(56, 46, 41, 0.14)); }
.mb-cloud { fill: var(--card); stroke: var(--primary); stroke-width: 1.7; }
.mb-q { fill: none; stroke: var(--primary); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.mb-qdot { fill: var(--primary); }
.mark-think .mark-bubble { transform-origin: 18% 88%; animation: think 3.2s ease-in-out infinite; }

.lang-select {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-select:hover { background: rgba(56, 46, 41, 0.06); color: var(--ink); }
.lang-select:focus-within { box-shadow: 0 0 0 4px var(--ring); }
.lang-select select {
  padding: 6px 18px 6px 4px;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c4b42' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 2px center / 11px;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; }

.pill-proto { background: var(--primary-soft); color: var(--primary); }

.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.dot-count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

.user-chip { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 2px 2px 2px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--e1), var(--hi); }

.avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 1px 3px rgba(168, 72, 46, 0.35); }

.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)), var(--primary); color: #fff; box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 3px 6px rgba(168, 72, 46, 0.2), 0 12px 24px rgba(168, 72, 46, 0.28); }
.btn-primary:active:not(:disabled) { background: var(--primary-press); box-shadow: 0 1px 3px rgba(168, 72, 46, 0.3); }

.btn-outline { background: var(--card); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--e1), var(--hi); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); box-shadow: var(--e2), var(--hi); }

.btn-ghost { color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: rgba(56, 46, 41, 0.06); color: var(--ink); }
.btn-ghost.is-active { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), var(--e1); }

.btn-sm { min-height: 36px; padding: 6px 12px; border-radius: 999px; font-size: 14px; }

/* 有後台權限的人才看得到：到管理中心的入口，用品牌色凸顯 */
.btn-admin { border-color: #ecd2c6; background: var(--primary-soft); color: var(--primary); box-shadow: var(--e1), var(--hi); }
.btn-admin:hover:not(:disabled) { border-color: var(--primary); background: #f1d9cd; color: var(--primary-hover); box-shadow: var(--e2), var(--hi); }

.btn-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 999px; }

.btn-sso { width: 100%; min-height: 52px; border-radius: 16px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)), var(--ink); color: #fff; font-size: 16px; box-shadow: 0 2px 4px rgba(56, 46, 41, 0.18), 0 10px 22px rgba(56, 46, 41, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.btn-sso:hover:not(:disabled) { background: #2a221e; box-shadow: 0 3px 6px rgba(56, 46, 41, 0.2), 0 14px 28px rgba(56, 46, 41, 0.26); }
.btn-sso:disabled { opacity: 0.85; cursor: progress; }

.link-inline { padding: 0; border: none; background: none; color: var(--primary); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ------------------------------------------------------------ start page: one input, nothing else */

.start {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar));
  min-height: calc(100dvh - var(--topbar));
  padding: 24px 16px 14vh;
}

.start-inner { width: 100%; max-width: 680px; }

.start-mark { margin: 0 0 30px; }
.start-mark .mark { display: block; margin: 0 auto; }
.start-mark .mark img { filter: drop-shadow(0 10px 16px rgba(56, 46, 41, 0.2)); }
.start-mark .mark-bubble { filter: drop-shadow(0 4px 6px rgba(56, 46, 41, 0.16)); }

/* ------------------------------------------------------------ composer */

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--e2), var(--hi);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring), var(--e2); }
/* 首頁的大輸入框是唯一主角，浮得最高 */
.composer.big { box-shadow: var(--e3), var(--hi); }
.composer.big:focus-within { box-shadow: 0 0 0 4px var(--ring), var(--e3); }

.composer-input {
  display: block;
  width: 100%;
  min-height: 28px;
  max-height: 40vh;
  padding: 4px 2px;
  border: none;
  outline: none;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
}
.composer.big .composer-input { min-height: 100px; font-size: 18px; }

/* 半透明的提問字 */
.composer-input::placeholder { color: var(--ink-soft); opacity: 0.42; }

.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.attach-btn:hover { background: rgba(56, 46, 41, 0.06); color: var(--ink); }
.attach-btn:focus-within { box-shadow: 0 0 0 4px var(--ring); }
.composer.docked .attach-btn { padding: 6px 8px; }

.send-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0)), var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: background 0.15s, transform 0.06s, opacity 0.15s, box-shadow 0.15s;
}
.send-btn:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 3px 6px rgba(168, 72, 46, 0.2), 0 12px 24px rgba(168, 72, 46, 0.3); }
.send-btn:active:not(:disabled) { transform: scale(0.95); }
.send-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.send-btn:disabled { background: var(--line-strong); box-shadow: none; opacity: 0.7; cursor: not-allowed; }
.composer.is-sending .send-btn:disabled { background: var(--primary); opacity: 1; cursor: progress; }

.pending-files { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }

.pf { position: relative; }

.pf-img img { width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--e1); }

.pf-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tint);
  color: var(--ink-soft);
  font-size: 13px;
}

.pf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pf-x {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.pf-file .pf-x { top: 50%; right: 8px; transform: translateY(-50%); border: none; background: rgba(56, 46, 41, 0.12); color: var(--ink); }

.drop-hint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: inherit;
  background: rgba(246, 229, 220, 0.94);
  color: var(--primary);
  font-weight: 600;
  pointer-events: none;
}
.composer.dragging { border-style: dashed; border-color: var(--primary); }
.composer.dragging .drop-hint { display: flex; }

/* ------------------------------------------------------------ chat */

.chat {
  display: flex;
  flex-direction: column;
  max-width: 760px;
  min-height: calc(100vh - var(--topbar));
  min-height: calc(100dvh - var(--topbar));
  margin: 0 auto;
  padding: 0 16px;
}

.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 0 4px; }

.chat-title { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.35; }

.chat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 700; }

.chat-sub { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }

.messages { display: flex; flex: 1; flex-direction: column; gap: 16px; margin: 0; padding: 16px 0 20px; list-style: none; }

.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; }
.msg.mine { align-self: flex-end; }

.msg-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.msg.mine .msg-body { align-items: flex-end; }

.msg-avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }

.msg-name { margin-left: 4px; color: var(--muted); font-size: 12.5px; }
/* AI 助理的追問：淡色泡泡＋星星頭像，跟真人回覆分得出來 */
.msg-avatar-ai { background: linear-gradient(135deg, #f6e5dc, #efd2c2); color: var(--primary); box-shadow: inset 0 0 0 1px #ecd2c6; }
.msg.ai .bubble { border-color: #ecd2c6; background: linear-gradient(180deg, #fffaf6, #fdf3ec); }

.bubble { padding: 10px 14px; border-radius: 18px; font-size: 15.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.mine .bubble { border-bottom-right-radius: 6px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)), var(--primary); color: #fff; box-shadow: 0 2px 4px rgba(168, 72, 46, 0.14), 0 6px 14px rgba(168, 72, 46, 0.16); }
.theirs .bubble { border: 1px solid var(--line); border-bottom-left-radius: 6px; background: var(--card); box-shadow: var(--e2), var(--hi); }

.msg-time { padding: 0 4px; color: var(--muted); font-size: 11.5px; }

.att-grid { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 340px; }
.theirs .att-grid { justify-content: flex-start; }

.att-img { width: 150px; height: 112px; object-fit: cover; border: 1px solid var(--line); border-radius: 14px; background: var(--tint); box-shadow: var(--e1); }
.att-link { display: block; border-radius: 14px; transition: transform 0.15s; }
.att-link:hover { transform: translateY(-1px); }
.att-link:focus-visible, a.att-file:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
a.att-file { text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
a.att-file:hover { border-color: var(--line-strong); box-shadow: var(--e2); }

.att-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 13px;
  box-shadow: var(--e1);
}

.att-size { color: var(--muted); font-size: 12px; white-space: nowrap; }

.msg-system {
  display: flex;
  align-self: center;
  align-items: flex-start;
  gap: 6px;
  max-width: 92%;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--tint);
  color: var(--ink-soft);
  font-size: 13.5px;
  box-shadow: inset 0 0 0 1px rgba(231, 219, 207, 0.8);
}
.msg-system .icon { margin-top: 3px; color: var(--success); }

.dock {
  position: sticky;
  bottom: 0;
  padding: 10px 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, rgba(246, 240, 231, 0));
}

/* ------------------------------------------------------------ my tickets */

.page { max-width: 760px; margin: 0 auto; padding: 30px 16px 40px; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.list-head h1 { margin: 0; font-size: 26px; }

.conv-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--e1), var(--hi);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.conv-row:hover { border-color: var(--line-strong); box-shadow: var(--e3), var(--hi); transform: translateY(-2px); }
.conv-row:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
/* 輪到客戶回覆的工單：左邊一條紅、浮起來，一眼就看到 */
.conv-row.needs-reply { border-color: #f1c9c1; border-left: 4px solid var(--danger); padding-left: 13px; background: linear-gradient(90deg, #fff5f2, var(--card) 45%); box-shadow: var(--e2), var(--hi); }

.conv-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }

.conv-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.conv-meta { color: var(--muted); font-size: 13px; }

.status { display: inline-flex; flex: none; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.status-open { background: var(--info-bg); color: var(--info); }
.status-in_progress { background: var(--warn-bg); color: var(--warn); }
.status-waiting { background: var(--danger-bg); color: var(--danger); }
.status-done { background: var(--success-bg); color: var(--success); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 56px 20px; color: var(--ink-soft); text-align: center; }

.list-foot { margin-top: 28px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ------------------------------------------------------------ sign-in dialog */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
  background: rgba(40, 30, 24, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.15s ease-out;
}

.dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 30px 28px 24px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--e4), var(--hi);
  animation: rise 0.2s ease-out;
}

.dialog-x { position: absolute; top: 14px; right: 14px; }

.dialog-head { margin-bottom: 22px; text-align: center; }
.dialog-head .mark { display: block; margin: 10px auto 0; }
.dialog-head h2 { margin: 12px 0 6px; font-size: 22px; }
.dialog-head p { color: var(--ink-soft); font-size: 14.5px; }

.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  box-shadow: var(--well);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

.code-form { display: flex; gap: 8px; }

.code-input { flex: 1; min-width: 0; font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.code-input::placeholder { font-family: var(--sans); letter-spacing: normal; text-transform: none; color: var(--muted); opacity: 0.8; }

.form-error { margin-top: 10px; padding: 9px 12px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); font-size: 14px; }

.fine { margin-top: 14px; color: var(--muted); font-size: 12.5px; text-align: center; }
.fine.proto { margin-top: 4px; color: #a8958a; }

/* ------------------------------------------------------------ toast */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--e4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: none; }

/* ------------------------------------------------------------ motion */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes think { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7%) rotate(-4deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 560px) {
  .hide-xs { display: none; }
  .topbar-inner { gap: 6px; padding: 0 12px; }
  .brand { gap: 8px; }
  .brand-name { overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
  .pill-proto { display: none; }
  .top-actions { gap: 4px; }
  .top-actions .btn-sm { padding: 6px 9px; }
  .lang-select { padding-left: 4px; }
  .lang-select .icon { display: none; }
  .composer.big .composer-input { min-height: 88px; font-size: 17px; }
  .msg { max-width: 92%; }
  .att-img { width: 128px; height: 96px; }
  .dialog { padding: 26px 20px 20px; border-radius: 24px; }
  .code-form { flex-direction: column; }
}

/* 很窄而且已登入：右邊按鈕比較多，品牌字收起來只留兔子（連結仍有 aria-label 名稱） */
@media (max-width: 400px) {
  .topbar.has-user .brand-name { display: none; }
}

/* 很窄的手機（例如 320 寬）放不下文字，只留圖示 */
@media (max-width: 360px) {
  .btn-admin .admin-label { display: none; }
  .btn-admin { padding-left: 9px; padding-right: 9px; }
}
