/* LinkDesk 正式页面样式：取自已确认设计稿 design/ui.css，只保留真实页面用到的部分。 */
:root {
  --ink: #10302a; --ink-2: #1a443b; --ink-3: #2a5a4e; --on-ink: #e8f1ed; --on-ink-2: #b4cbc2;
  --canvas: #f3f1ec; --panel: #fff; --panel-2: #faf9f6; --line: #e3e0d8; --line-2: #cfcbc0;
  --text: #1c2624; --text-2: #55615c; --text-3: #6a746f;
  --green: #0f7a55; --green-d: #0b6245; --green-bg: #e6f3ec;
  --amber: #8f5300; --amber-dot: #d98a12; --amber-bg: #fcf2dd; --amber-line: #eed9ac;
  --red: #ad332a; --red-d: #8f2820; --red-bg: #fbeae7; --red-line: #f0cbc6;
  --r-s: 4px; --r-m: 6px; --r-l: 10px;
  --shadow: 0 1px 2px rgba(16, 48, 42, .05), 0 8px 24px rgba(16, 48, 42, .07);
  --shadow-l: 0 2px 6px rgba(16, 48, 42, .1), 0 24px 56px rgba(16, 48, 42, .2);
  --latin: "Avenir Next", Avenir, "Segoe UI", "PingFang SC", sans-serif;
  --body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 14px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: var(--r-s); }
main:focus, .ws-main:focus { outline: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 70; padding: 6px 12px; border-radius: var(--r-m); background: var(--panel); }
.skip-link:focus { top: 8px; }
.ic { width: 18px; height: 18px; flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; flex: none; }
.num { font-family: var(--latin); font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-m); background: var(--panel); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { background: var(--panel-2); border-color: #b7b3a8; }
.btn:disabled { color: #8a918d; background: #f1efea; border-color: var(--line); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-d); border-color: var(--green-d); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-small { min-height: 28px; padding: 0 9px; font-size: 13px; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spin { display: none; }
.btn.is-busy .spin { display: block; }
.btn.is-busy [data-icon] { display: none; }

/* 状态点、状态条 */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #8a918d; }
.dot.ok { background: #17a26f; }
.dot.wait { background: var(--amber-dot); }
.dot.bad { background: var(--red); }
.notice { display: block; flex: none; padding: 8px 14px; font-size: 13px; line-height: 1.5; border-bottom: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); overflow-wrap: anywhere; }
.notice.wait { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.notice.bad { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.notice.ok { background: var(--green-bg); border-color: #cae4d6; color: var(--green-d); }

/* 字段 */
.field-label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; }
.input { display: block; width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--r-m); background-color: var(--panel); }
.input::placeholder, .composer-input::placeholder { color: var(--text-3); }
.field-error { margin-top: 4px; color: var(--red); font-size: 13px; }

/* 消息与滚动 */
.timeline-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { display: flex; flex-direction: column; }
.jump { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); box-shadow: var(--shadow); }

/* ———— 客户窗口 ———— */
.cl-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.cl-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.cl-window { display: flex; flex-direction: column; width: 100%; max-width: 420px; height: 100%; max-height: 720px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.cl-head { display: flex; align-items: center; gap: 10px; flex: none; padding: 12px 14px; background: var(--ink); color: var(--on-ink); }
.cl-head .brand-mark { width: 30px; height: 30px; }
.cl-head-text { min-width: 0; flex: 1; }
.cl-brand { font: 600 15px/1.3 var(--latin); }
.cl-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--on-ink-2); }
.cl-status .dot { flex: none; }
#visitor-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-2); }
.cl-log > :first-child { margin-top: auto; }
.cl-log .messages { gap: 12px; }
.cl-log .welcome[hidden] + .messages { margin-top: auto; }
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; max-width: 84%; animation: rise .16s ease-out; }
.bubble-row.me { align-self: flex-end; align-items: flex-end; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.bubble-who { max-width: 100%; margin-bottom: 2px; font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.bubble { padding: 8px 11px; border: 1px solid var(--line); border-radius: 3px 10px 10px 10px; background: var(--panel); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.bubble-head { display: flex; align-items: baseline; gap: 4px; min-width: 0; max-width: 100%; margin-bottom: 2px; font-size: 12px; color: var(--text-2); }
.bubble-head .bubble-who { min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bubble-dot, .bubble-time { flex: none; color: var(--text-3); white-space: nowrap; }
.bubble-time { font-size: 11px; }
.welcome h2 { font-size: 17px; font-weight: 600; color: var(--ink); }
.welcome p { color: var(--text-2); margin: 2px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--panel); font-size: 13px; }
.cl-form { flex: none; }
.cl-form > .notice { border-top: 1px solid var(--red-line); border-bottom: 0; }
.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px; background: var(--panel); border-top: 1px solid var(--line); }
.composer-input { flex: 1; min-width: 0; min-height: 38px; max-height: 120px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-m); background: var(--panel); resize: none; field-sizing: content; line-height: 1.5; }
.composer-input:focus-visible { outline-offset: 0; }
.composer-input:disabled { color: var(--text-3); cursor: not-allowed; }
.send-btn { width: 38px; min-height: 38px; padding: 0; }
.cl-actions { display: flex; justify-content: center; padding: 0 12px 8px; background: rgba(255, 252, 248, .42); }
.cl-actions:not(:has(> :not([hidden]))) { display: none; }

/* ———— 工作台 ———— */
.ws-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.ws { flex: 1; min-height: 0; display: grid; grid-template-columns: 196px minmax(0, 1fr); }
.ws-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ws-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ws-top-title { min-width: 0; }
.ws-top h1 { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.ws-top p { color: var(--text-2); font-size: 12px; }
.ws-top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
/* 顶栏账号：单行“状态点 + 对外昵称 + 编辑提示”，与退出按钮同高，整块打开个人资料。
   登录正常时状态文字只留给读屏；连接异常时才以“· 连接异常”显示在昵称后 */
.ws-me { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 240px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-m); background: var(--panel); text-align: left; transition: background .12s, border-color .12s; }
.ws-me:hover { background: var(--panel-2); border-color: #b7b3a8; }
.ws-me .dot { flex: none; }
.ws-me .ic { width: 15px; height: 15px; flex: none; color: var(--text-3); }
.ws-me-text { display: flex; align-items: baseline; gap: 4px; min-width: 0; line-height: 1.4; }
.ws-me-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.ws-me-name:is([data-state="loading"], [data-state="none"], [data-state="empty"]) { color: var(--text-3); font-weight: 500; }
.ws-me-name[data-state="failed"] { color: var(--amber); font-weight: 500; }
.ws-me-state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ws-me-state[data-state="bad"] { position: static; flex: none; width: auto; height: auto; overflow: visible; clip-path: none; color: var(--amber); font-size: 12px; font-weight: 500; }
.ws-me-state[data-state="bad"]::before { content: "· "; }
.ws-top-actions > #staff-logout { min-height: 34px; padding: 0 12px; }
.ws-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 264px minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr); }
.rail { position: relative; z-index: 20; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 10px 10px; background: var(--ink); color: var(--on-ink-2); }
.rail :focus-visible { outline-color: #9fe3c6; }
.rail-brand { display: flex; align-items: center; gap: 9px; padding: 0 6px; margin-bottom: 18px; }
.rail-brand .brand-mark { width: 30px; height: 30px; display: block; }
.rail-brand-text strong { display: block; color: #fff; font: 600 15px/1.3 var(--latin); }
.rail-brand-text small { display: block; color: var(--on-ink-2); font-size: 12px; line-height: 1.4; }
.rail-item { position: relative; display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 10px; border-radius: var(--r-m); text-align: left; text-decoration: none; }
.rail-item:hover { background: var(--ink-2); color: #fff; }
.rail-item[aria-current="page"] { background: var(--ink-3); color: #fff; }
.rail-badge { margin-left: auto; min-width: 16px; padding: 0 4px; border-radius: 8px; background: var(--amber-dot); color: #231602; font: 600 11px/16px var(--latin); text-align: center; }

.queue { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); border-right: 1px solid var(--line); }
.queue-head { flex: none; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.queue-head h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.search { position: relative; }
/* 图标包装不占文档流，放大镜才会落在输入框内左侧 */
.search > [data-icon] { position: absolute; inset: 0 auto auto 0; }
.search .ic { position: absolute; left: 9px; top: 9px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 30px; min-height: 34px; font-size: 13px; }
.queue-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.queue-group + .queue-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.queue-title { display: flex; align-items: center; gap: 6px; padding: 4px 10px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.queue-title:focus { outline: none; }
.count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: #ebe8e1; color: var(--text); font-size: 11px; line-height: 18px; text-align: center; }
.q-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: var(--r-m); text-align: left; }
.q-item:hover:not(:disabled) { background: #f1efe9; }
.q-item:disabled { color: var(--text-3); }
.q-item[aria-current="true"] { background: var(--panel); border-color: var(--line-2); box-shadow: inset 3px 0 0 var(--green); }
.q-code { font: 600 14px/1.5 var(--latin); overflow-wrap: anywhere; }
.q-action { align-self: center; color: var(--green-d); font-size: 13px; font-weight: 500; }
.q-src { grid-column: 1 / -1; font-size: 12px; color: var(--text-2); }
.q-empty { padding: 18px; text-align: center; color: var(--text-2); font-size: 13px; }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-top { flex: none; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 { font-size: 15px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title h2:focus { outline: none; }
.chat-title p { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.chat-actions { display: flex; gap: 6px; flex: none; }
.only-narrow, .only-drawer { display: none; }
/* 账本式消息：左侧时间槽对齐，便于快速回溯 */
.ledger { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 0; background: var(--panel); }
.lg-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); padding: 5px 20px 5px 0; }
.lg-time { padding-top: 1px; padding-right: 12px; color: var(--text-3); font-size: 12px; text-align: right; }
.lg-main { padding-left: 12px; border-left: 2px solid var(--line); max-width: 680px; }
.lg-row.me .lg-main { border-left-color: var(--green); }
.lg-who { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); }
.lg-row.me .lg-who { color: var(--green-d); }
.lg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ws-composer { position: relative; flex: none; padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.ws-composer .composer-input { width: 100%; min-height: 62px; max-height: 180px; display: block; }
.ws-composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.kbd-hint { flex: 1; color: var(--text-3); font-size: 12px; }
.state-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--canvas); overflow-y: auto; }
.state-card { width: min(420px, calc(100% - 32px)); margin: auto; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); box-shadow: var(--shadow); }
.state-card .ic { width: 24px; height: 24px; margin-bottom: 8px; color: var(--text-3); }
.state-card h2 { font-size: 17px; font-weight: 600; }
.state-card p { margin-top: 4px; color: var(--text-2); }
.kv { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { overflow-wrap: anywhere; }

.ctx { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); border-left: 1px solid var(--line); }
.ctx-head { flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.ctx-head h2 { font-size: 15px; font-weight: 600; }
.ctx-body { flex: 1; min-height: 0; overflow-y: auto; }
.ctx-sec { padding: 12px 14px; }
.ctx-sec .kv:last-child { border-bottom: 0; }
.ctx-empty { padding: 28px 18px; color: var(--text-2); font-size: 13px; text-align: center; }
.ctx-scrim { display: none; }

.gate { flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; background: var(--ink); overflow-y: auto; }
.gate-status { color: var(--on-ink); text-align: center; }
.login-card { margin: 0; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .brand-mark { width: 30px; height: 30px; flex: none; }
.login-brand h1 { font-size: 17px; font-weight: 600; color: var(--ink); }
.login-status { padding: 6px 10px; border-radius: var(--r-m); background: var(--green-bg); color: var(--green-d) !important; font-size: 13px; }
.login-form { margin-top: 14px; }
.login-form .input { margin-bottom: 12px; }
.login-form .field-error { margin: 0 0 12px; }
.login-form .btn { width: 100%; }

/* ———— 响应式 ———— */
@media (max-width: 1180px) {
  .ws { grid-template-columns: 64px minmax(0, 1fr); }
  .ws-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .rail { align-items: center; padding: 12px 0; }
  .rail-brand { display: block; padding: 0; margin-bottom: 12px; }
  .rail-brand-text { display: none; }
  .rail-item { flex-direction: column; justify-content: center; gap: 2px; width: 54px; min-height: 0; padding: 7px 0 5px; font-size: 11px; line-height: 1.3; }
  .rail-badge { position: absolute; top: 2px; right: 6px; margin: 0; }
  .only-drawer { display: inline-flex; }
  .ctx { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(320px, 100%); visibility: hidden; transform: translateX(100%); transition: transform .18s ease-out, visibility .18s; box-shadow: var(--shadow-l); }
  .ctx.is-open { visibility: visible; transform: none; }
  .ctx-scrim.is-open { display: block; position: fixed; z-index: 35; inset: 0; background: rgba(16, 48, 42, .35); }
}
@media (max-width: 720px) {
  .cl-stage { padding: 0; align-items: stretch; }
  .cl-window { max-width: none; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
  .composer-input, .input { font-size: 16px; }

  .ws { display: flex; flex-direction: column; }
  .ws-main { flex: 1; }
  .ws-grid { display: flex; flex-direction: column; }
  .ws-top { min-height: 44px; padding: 6px 12px; }
  .ws-top h1 { font-size: 15px; }
  .ws-top p, .queue-head h2 { display: none; }
  .ws[data-view="chat"] .ws-top { display: none; }
  /* 手机：账号收成一行“状态点 + 昵称 + 编辑”，登录状态与“退出登录”文字只留给读屏 */
  .ws-top-actions { min-width: 0; flex: 0 1 auto; }
  .ws-me { max-width: 170px; min-height: 38px; padding: 0 8px; }
  .ws-me-state, .ws-me-state[data-state="bad"], .ws-logout-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ws-top-actions > #staff-logout { width: 38px; min-height: 38px; padding: 0; }
  .rail { flex: none; flex-direction: row; gap: 6px; padding: 6px 10px; }
  .rail-brand { margin: 0 6px 0 0; }
  .rail-item { flex-direction: row; gap: 5px; width: auto; min-height: 36px; padding: 0 9px; font-size: 13px; }
  .rail-badge { position: static; }
  .queue { flex: 1; min-height: 0; border-right: 0; }
  .q-item { padding: 11px 10px; }
  .center { flex: 1; min-height: 0; }
  .ws[data-view="list"] .center { display: none; }
  .ws[data-view="chat"] .rail, .ws[data-view="chat"] .queue { display: none; }
  .only-narrow { display: inline-flex; }
  .chat-top { padding: 6px 8px; gap: 4px; }
  .chat-actions .btn { width: 38px; min-height: 38px; padding: 0; }
  .chat-actions .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .icon-only-m { width: 38px; min-height: 38px; padding: 0; }
  .lg-row { grid-template-columns: 50px minmax(0, 1fr); padding-right: 12px; }
  .lg-time { padding-right: 8px; }
  .lg-main { padding-left: 9px; }
  .ws-composer { padding: 8px; }
  .kbd-hint { display: none; }
  .ws-composer-row { justify-content: flex-end; }
  .ctx { width: 100%; }
  .btn { min-height: 38px; }
}

/* ———— 工作台：消息归属、列表摘要、访客来源 ———— */
.lg-row.me { grid-template-columns: minmax(0, 1fr) 62px; padding: 5px 0 5px 20px; }
.lg-row.me .lg-time { order: 2; padding-right: 0; padding-left: 10px; text-align: left; }
.lg-row.me .lg-main { order: 1; justify-self: end; min-width: 0; padding: 0 12px 0 0; border-left: 0; border-right: 2px solid var(--green); }
.lg-row.me .lg-who { text-align: right; }
.lg-row[data-relation="other_staff"] .lg-main { border-left-color: var(--amber-dot); }
.lg-row[data-relation="other_staff"] .lg-who { color: var(--amber); }

.q-preview { grid-column: 1 / -1; display: block; min-width: 0; overflow: hidden; margin-top: 2px; color: var(--text-2); font-size: 12px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.q-preview[data-state="pending"] { color: var(--text-3); }
.q-preview[data-state="denied"] { color: var(--amber); }
.q-preview[data-state="bad"] { color: var(--red); }
.q-preview-who { color: var(--green-d); font-weight: 500; }

.src { min-width: 0; font-size: 12px; line-height: 1.5; color: var(--text-2); }
.src-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.src-title { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.src-note { color: var(--text-3); }
.src-fields { display: flex; flex-wrap: wrap; gap: 0 12px; }
.src-field { min-width: 0; overflow-wrap: anywhere; }
.src-k { margin-right: 4px; color: var(--text-3); }
.src-v { color: var(--text); }
.src[data-state="bad"] .src-state { color: var(--red); }
.src[data-state="denied"] .src-state, .src[data-state="error"] .src-state { color: var(--amber); }
.src-strip { flex: 999 1 380px; max-height: 76px; overflow-y: auto; padding: 3px 10px; border-left: 2px solid var(--line); }
.chat-top { flex-wrap: wrap; }
.chat-title { flex: 1 1 200px; }
.src-lookup { border-top: 1px solid var(--line); }
.src-lookup h3 { font-size: 13px; font-weight: 600; }
.src-lookup-hint { color: var(--text-3); font-size: 12px; }
.src-lookup-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.src-lookup-form .input { flex: 1 1 130px; width: auto; min-width: 0; min-height: 30px; padding: 4px 8px; font-size: 13px; }
.src-card { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); }
.src-card .src-fields { flex-direction: column; }

@media (max-width: 1180px) {
  .src-strip { order: 3; flex: 1 0 100%; padding: 2px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .lg-row.me { grid-template-columns: minmax(0, 1fr) 50px; padding: 5px 0 5px 12px; }
  .lg-row.me .lg-time { padding-left: 6px; padding-right: 0; }
  .lg-row.me .lg-main { padding: 0 9px 0 0; }
  .src-strip { max-height: 58px; padding: 2px 4px 0; }
  .src-lookup-form .input { font-size: 16px; min-height: 38px; }
}
@media (max-height: 520px) {
  .src-strip { max-height: 24px; }
}

/* ———— 访客窗口 · 暖色液态玻璃（只覆盖 .cl-body，工作台不受影响） ———— */
.cl-body {
  --ink: #3b2417; --on-ink: #3b2417; --on-ink-2: #6b4632;
  --canvas: #f4dfcd; --panel: rgba(255, 250, 245, .72); --panel-2: rgba(255, 246, 238, .55);
  --line: rgba(122, 74, 44, .16); --line-2: rgba(122, 74, 44, .3);
  --text: #3b2417; --text-2: #6b4632; --text-3: #7a5238;
  --green: #8a4420; --green-d: #8a4420; --green-bg: #f8e5d3;
  --amber: #7f4a00; --red: #9f2c22; --red-d: #8a241b;
  --copper: #a4552a; --copper-d: #8a4420; --ok-ink: #3f6b3a;
  --glass-edge: rgba(255, 255, 255, .72);
  --r-s: 8px; --r-m: 14px; --r-l: 20px;
  --shadow: 0 2px 6px rgba(122, 74, 44, .08), 0 14px 32px rgba(122, 74, 44, .12);
  --shadow-l: 0 4px 12px rgba(122, 74, 44, .1), 0 32px 72px rgba(122, 74, 44, .24);
  background:
    radial-gradient(46% 52% at 12% 16%, rgba(255, 244, 232, .95), transparent 72%),
    radial-gradient(42% 50% at 88% 12%, rgba(240, 190, 150, .62), transparent 72%),
    radial-gradient(52% 58% at 76% 92%, rgba(226, 160, 118, .5), transparent 74%),
    radial-gradient(44% 50% at 18% 90%, rgba(250, 214, 186, .85), transparent 72%),
    linear-gradient(150deg, #f8e9db, #eecdb4);
}
/* 单窗高度取舞台内容盒的 100%，自动扣除留白；视口矮于下限时由舞台滚动，auto 外边距避免顶部被裁 */
.cl-body .cl-stage { --cl-py: clamp(12px, 4vh, 40px); --cl-px: clamp(12px, 4vw, 40px); overflow-y: auto; padding: max(var(--cl-py), env(safe-area-inset-top)) max(var(--cl-px), env(safe-area-inset-right)) max(var(--cl-py), env(safe-area-inset-bottom)) max(var(--cl-px), env(safe-area-inset-left)); }
.cl-body .cl-window { position: relative; max-width: 540px; height: 100%; min-height: 280px; max-height: 760px; margin: auto; background: rgba(255, 247, 240, .58); border: 1px solid var(--glass-edge); border-radius: 28px; box-shadow: var(--shadow-l), inset 0 1px 0 rgba(255, 255, 255, .85); -webkit-backdrop-filter: blur(22px) saturate(135%); backdrop-filter: blur(22px) saturate(135%); }
/* 空间不足时消息区保底，表单自身滚动，输入框不会被窗口裁掉 */
.cl-body .timeline-wrap { min-height: 96px; }
.cl-body .cl-form { flex: 0 1 auto; min-height: 0; overflow-y: auto; }

.cl-body .brand-mark { border-radius: 50%; }
.cl-body .brand-mark rect { fill: var(--copper); }
.cl-body .btn { border-radius: 999px; background: rgba(255, 250, 245, .78); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7); }
.cl-body .btn:hover:not(:disabled) { background: #fffaf5; border-color: var(--copper); }
.cl-body .btn:disabled { color: #806450; background: rgba(233, 211, 194, .7); border-color: var(--line); box-shadow: none; }
.cl-body .btn-primary { background: linear-gradient(180deg, #ad5c30, var(--copper)); border-color: var(--copper-d); color: #fff; box-shadow: 0 6px 14px rgba(138, 68, 32, .24), inset 0 1px 0 rgba(255, 255, 255, .28); }
.cl-body .btn-primary:hover:not(:disabled) { background: var(--copper-d); border-color: var(--copper-d); }
.cl-body .notice { background: rgba(255, 248, 241, .6); }
.cl-body .notice.wait { background: rgba(252, 236, 208, .9); }
.cl-body .notice.bad { background: rgba(251, 232, 228, .92); }
.cl-body .notice.ok { background: rgba(234, 240, 217, .92); border-color: #cfdcae; color: var(--ok-ink); }

.cl-body .cl-head { padding: 14px 16px; background: rgba(255, 252, 248, .36); border-bottom: 1px solid var(--line); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .4); }
.cl-body .cl-head .brand-mark { width: 38px; height: 38px; box-shadow: 0 4px 10px rgba(138, 68, 32, .24); }
.cl-body .cl-log { padding: 18px 16px; gap: 12px; background: transparent; }
.cl-body .cl-log:focus-visible { outline-offset: -3px; border-radius: 12px; }
.cl-body .bubble { padding: 9px 13px; border-color: var(--glass-edge); border-radius: 6px 18px 18px 18px; background: rgba(255, 252, 248, .84); box-shadow: 0 2px 8px rgba(122, 74, 44, .08); }
.cl-body .me .bubble { border-color: var(--copper-d); border-radius: 18px 6px 18px 18px; background: linear-gradient(170deg, #a95c30, #8f4821); color: #fff; }

/* 嵌套玻璃卡片 */
.cl-body .welcome { padding: 16px; border: 1px solid var(--glass-edge); border-radius: var(--r-l); background: rgba(255, 251, 247, .62); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .8); }
.cl-body .welcome p { margin-bottom: 0; }

.cl-body .composer { align-items: flex-end; padding: 10px 12px; background: rgba(255, 252, 248, .42); border-top-color: var(--line); }
.cl-body .composer-input { min-height: 42px; padding: 9px 14px; border-radius: 21px; background: rgba(255, 253, 251, .92); box-shadow: inset 0 1px 2px rgba(122, 74, 44, .08); }
.cl-body .send-btn { width: 42px; min-height: 42px; }

@media (max-height: 600px) {
  .cl-body .cl-stage { --cl-py: 8px; }
  .cl-body .cl-head { padding-top: 8px; padding-bottom: 8px; }
}
/* 手机竖屏与触屏矮横屏：铺满可见区，四边安全区由头部、消息区与表单各自让出；
   --cl-vv-h/--cl-vv-top 仅在可见视口被键盘压缩而布局视口未变时由脚本写入 */
@media (max-width: 720px), (pointer: coarse) and (max-height: 520px) and (max-width: 950px) {
  .cl-body { height: 100vh; height: var(--cl-vv-h, 100dvh); padding-top: var(--cl-vv-top, 0px); }
  .cl-body .cl-stage { padding: 0; align-items: flex-start; }
  .cl-body .cl-window { max-width: none; height: 100%; min-height: 240px; max-height: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .cl-body .cl-head { padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
  .cl-body .cl-head .brand-mark { width: 34px; height: 34px; }
  .cl-body .cl-log { padding: 14px max(12px, env(safe-area-inset-right)) 14px max(12px, env(safe-area-inset-left)); }
  .cl-body .bubble-row { max-width: 88%; }
  .cl-body .cl-history-head { padding: 4px max(12px, env(safe-area-inset-right)) 4px max(12px, env(safe-area-inset-left)); }
  .cl-body .cl-history-list { padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); }
  .cl-body .cl-history-item { min-height: 44px; }
  .cl-body .cl-history-head .btn, .cl-body .cl-actions .btn { min-height: 44px; }
  .cl-body .cl-form { padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: rgba(255, 252, 248, .42); }
  .cl-body .composer { gap: 6px; padding: 6px 8px; background: transparent; }
  .cl-body .composer-input { min-height: 44px; padding: 10px 14px; border-radius: 22px; font-size: 16px; line-height: 1.4; }
  .cl-body .composer .attach-btn, .cl-body .composer .emoji-btn, .cl-body .composer .send-btn { width: 44px; min-height: 44px; }
  .cl-body .attachment { width: 220px; }
}
/* 矮屏（含键盘弹出后）：压缩头部，消息区保底更小，仍不够时舞台自然滚动到输入框 */
@media (max-width: 720px) and (max-height: 560px), (pointer: coarse) and (max-height: 520px) and (max-width: 950px) {
  .cl-body .cl-stage { overflow-y: auto; }
  .cl-body .cl-head { gap: 8px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .cl-body .cl-head .brand-mark { width: 28px; height: 28px; }
  .cl-body .cl-brand { font-size: 14px; }
  .cl-body .cl-log { padding-top: 10px; padding-bottom: 10px; }
  .cl-body .timeline-wrap { min-height: 72px; }
}

/* ———— 客服工作台 · 柔和玻璃（只覆盖 data-page="workspace"）。
   卡片不用 backdrop-filter：它会让表情浮层等 fixed 元素改以卡片为定位基准 ———— */
[data-page="workspace"] {
  --canvas: #eef3ef; --panel: rgba(255, 255, 255, .72); --panel-2: rgba(255, 255, 255, .56);
  --line: rgba(16, 48, 42, .09); --line-2: rgba(16, 48, 42, .17);
  --text: #10302a; --text-2: #46625a; --text-3: #5d736c;
  --glass-edge: rgba(255, 255, 255, .78); --glass-blur: blur(18px) saturate(130%);
  --r-s: 8px; --r-m: 12px; --r-l: 20px;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 10px 30px rgba(16, 48, 42, .07);
  --shadow-l: 0 4px 12px rgba(16, 48, 42, .1), 0 32px 72px rgba(16, 48, 42, .22);
  background:
    radial-gradient(52% 46% at 12% 0%, rgba(206, 238, 222, .95), transparent 70%) no-repeat,
    radial-gradient(46% 50% at 100% 100%, rgba(246, 228, 208, .9), transparent 70%) no-repeat,
    radial-gradient(40% 40% at 88% 8%, rgba(220, 238, 246, .7), transparent 70%) no-repeat,
    #eef3ef;
  background-attachment: fixed;
}
/* 按钮与字段 */
[data-page="workspace"] .btn { border-color: var(--line-2); background: rgba(255, 255, 255, .82); box-shadow: 0 1px 2px rgba(16, 48, 42, .06); }
[data-page="workspace"] .btn:hover:not(:disabled) { border-color: rgba(16, 48, 42, .26); background: #fff; }
[data-page="workspace"] .btn:disabled { border-color: var(--line); background: rgba(255, 255, 255, .45); color: #6f817b; box-shadow: none; }
[data-page="workspace"] .btn-quiet, [data-page="workspace"] .btn-quiet:disabled { border-color: transparent; background: transparent; box-shadow: none; }
[data-page="workspace"] .btn-quiet:hover:not(:disabled) { border-color: transparent; background: rgba(255, 255, 255, .7); }
[data-page="workspace"] .btn-primary { border-color: var(--green-d); background: linear-gradient(180deg, #13895f, var(--green)); color: #fff; box-shadow: 0 6px 14px rgba(15, 122, 85, .24), inset 0 1px 0 rgba(255, 255, 255, .22); }
[data-page="workspace"] .btn-primary:hover:not(:disabled) { border-color: var(--green-d); background: var(--green-d); }
[data-page="workspace"] .btn-danger { border-color: var(--red-d); background: var(--red); color: #fff; box-shadow: 0 6px 14px rgba(173, 51, 42, .2); }
[data-page="workspace"] .btn-danger:hover:not(:disabled) { border-color: var(--red-d); background: var(--red-d); }
[data-page="workspace"] .jump { box-shadow: 0 6px 18px rgba(16, 48, 42, .16); }
[data-page="workspace"] .input, [data-page="workspace"] .composer-input { border-color: var(--line-2); background-color: rgba(255, 255, 255, .86); }
[data-page="workspace"] .input:disabled, [data-page="workspace"] .composer-input:disabled, [data-page="workspace"] .dialog input.input:disabled { background-color: rgba(255, 255, 255, .45); color: var(--text-3); }
[data-page="workspace"] .ws-composer .composer-input { border-radius: 14px; }

/* 登录与检查登录状态 */
[data-page="workspace"] .gate { background: transparent; }
[data-page="workspace"] .gate-status { color: var(--text-2); }
[data-page="workspace"] .state-card { border-color: var(--glass-edge); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); }
[data-page="workspace"] .login-card { padding: 28px; box-shadow: var(--shadow-l), inset 0 1px 0 rgba(255, 255, 255, .85); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
[data-page="workspace"] .login-brand .brand-mark { width: 38px; height: 38px; filter: drop-shadow(0 4px 10px rgba(15, 122, 85, .28)); }
[data-page="workspace"] .login-brand h1 { font-size: 20px; font-weight: 700; }
[data-page="workspace"] .login-form .input, [data-page="workspace"] .login-form .btn { min-height: 42px; }

/* 外框：悬浮导航条 + 三块卡片 */
[data-page="workspace"] .ws { grid-template-columns: 208px minmax(0, 1fr); }
[data-page="workspace"] .rail { margin: 12px 0 12px 12px; border: 1px solid var(--glass-edge); border-radius: 22px; background: rgba(255, 255, 255, .56); color: var(--text-2); box-shadow: var(--shadow); }
[data-page="workspace"] .rail :focus-visible { outline-color: var(--green); }
[data-page="workspace"] .rail-brand .brand-mark { filter: drop-shadow(0 4px 8px rgba(15, 122, 85, .25)); }
[data-page="workspace"] .rail-brand-text strong { color: var(--ink); }
[data-page="workspace"] .rail-brand-text small { color: var(--text-3); }
[data-page="workspace"] .rail-item:not([aria-current="page"]):hover { background: rgba(255, 255, 255, .8); color: var(--ink); }
[data-page="workspace"] .rail-item[aria-current="page"] { background: var(--ink); color: #fff; box-shadow: 0 8px 20px rgba(16, 48, 42, .24); }
[data-page="workspace"] .ws-me { border-color: var(--line-2); background: rgba(255, 255, 255, .82); box-shadow: 0 1px 2px rgba(16, 48, 42, .06); }
[data-page="workspace"] .ws-me:hover { border-color: rgba(16, 48, 42, .26); background: #fff; }
[data-page="workspace"] .ws-main { gap: 12px; padding: 12px; }
[data-page="workspace"] .ws-main > .notice { border: 1px solid var(--line); border-radius: var(--r-m); }
[data-page="workspace"] .ws-main > .notice.wait { border-color: var(--amber-line); }
[data-page="workspace"] .ws-main > .notice.bad { border-color: var(--red-line); }
[data-page="workspace"] .ws-main > .notice.ok { border-color: #cae4d6; }
[data-page="workspace"] .ws-grid, [data-page="workspace"] .hist { gap: 12px; }
[data-page="workspace"] :is(.ws-top, .queue, .center, .ctx) { border: 1px solid var(--glass-edge); border-radius: var(--r-l); background: var(--panel); box-shadow: var(--shadow); }
[data-page="workspace"] :is(.queue, .center, .ctx) { overflow: hidden; }
[data-page="workspace"] .center { background: rgba(255, 255, 255, .8); }
[data-page="workspace"] :is(.ledger, .queue-scroll, .hist-scroll, .ctx-body):focus-visible { outline-offset: -3px; }
[data-page="workspace"] .ws-top h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
[data-page="workspace"] .queue-head h2, [data-page="workspace"] .ctx-head h2 { font-size: 16px; font-weight: 700; }
[data-page="workspace"] .chat-title h2 { font-size: 16px; font-weight: 700; }

/* 队列 */
[data-page="workspace"] .search .input { border-radius: 999px; }
[data-page="workspace"] .count { background: rgba(16, 48, 42, .07); }
[data-page="workspace"] .q-item { border-radius: 14px; }
[data-page="workspace"] .q-item:hover:not(:disabled) { background: rgba(255, 255, 255, .8); }
[data-page="workspace"] .q-item[aria-current="true"] { border-color: var(--glass-edge); background: #fff; box-shadow: inset 3px 0 0 var(--green), 0 4px 14px rgba(16, 48, 42, .08); }

/* 会话区与侧栏 */
[data-page="workspace"] .ledger, [data-page="workspace"] .state-pane { background: transparent; }
[data-page="workspace"] .state-card.idle { box-shadow: none; background: rgba(255, 255, 255, .55); }
[data-page="workspace"] .src-card, [data-page="workspace"] .internal-owner { border-radius: 14px; background: rgba(255, 255, 255, .6); }
[data-page="workspace"] .internal-form { border-radius: 14px; }

/* 弹窗 */
[data-page="workspace"] .dialog { padding: 22px; border-color: var(--glass-edge); background: rgba(248, 251, 249, .94); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
[data-page="workspace"] .dialog::backdrop { background: rgba(16, 48, 42, .28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

@media (max-width: 1180px) {
  [data-page="workspace"] .ws { grid-template-columns: 76px minmax(0, 1fr); }
  /* 会话信息改为右侧抽屉：脱离文档流，需接近不透明并带毛玻璃 */
  [data-page="workspace"] .ctx { border-width: 0 0 0 1px; border-radius: 22px 0 0 22px; background: rgba(248, 251, 249, .95); box-shadow: var(--shadow-l); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}
@media (max-width: 720px) {
  /* 手机：卡片贴边铺满，保留配色，不留外边距 */
  [data-page="workspace"] .rail { margin: 0; border-width: 0 0 1px; border-color: var(--line); border-radius: 0; background: rgba(255, 255, 255, .78); box-shadow: none; }
  [data-page="workspace"] .ws-main { gap: 0; padding: 0; }
  [data-page="workspace"] .ws-main > .notice { border-width: 0 0 1px; border-radius: 0; }
  [data-page="workspace"] .ws-grid, [data-page="workspace"] .hist { gap: 0; }
  [data-page="workspace"] :is(.ws-top, .queue, .center, .ctx) { border-width: 0; border-radius: 0; box-shadow: none; }
  [data-page="workspace"] .ws-top { border-bottom: 1px solid var(--line); }
  [data-page="workspace"] .login-card { padding: 22px; }
}
@media (prefers-reduced-transparency: reduce) {
  [data-page="workspace"] { --panel: #fff; --panel-2: #f7faf8; }
  [data-page="workspace"] :is(.login-card, .ctx, .dialog) { -webkit-backdrop-filter: none; backdrop-filter: none; }
  [data-page="workspace"] :is(.rail, .center, .dialog) { background: #fff; }
}
@media (max-width: 1180px) and (prefers-reduced-transparency: reduce) {
  [data-page="workspace"] .ctx { background: #fff; }
}

/* ———— 生命周期：访客窗内状态与过往咨询 ———— */
.cl-actions { flex-wrap: wrap; gap: 6px; }
.cl-form[data-readonly="true"] .composer { display: none; }
.cl-form[data-readonly="true"] .cl-actions { padding-top: 8px; }
.cl-history { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; min-height: 0; background: rgba(255, 248, 241, .97); }
.cl-history-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.cl-history-head h2 { font-size: 14px; font-weight: 600; }
.cl-history-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px; }
.cl-history-item { display: block; width: 100%; min-height: 36px; padding: 6px 8px; border-radius: var(--r-s); font-size: 13px; text-align: left; overflow-wrap: anywhere; }
.cl-history-item:hover { background: rgba(255, 252, 248, .9); }
.cl-history-item[aria-current="true"] { box-shadow: inset 3px 0 0 var(--copper); }

/* ———— 工作台：留言标记、转接与结束、历史 ———— */
select.input { font: inherit; color: inherit; }
/* 下拉框统一外观：去掉系统箭头，用两段渐变画细线下箭头（不引入图片，不受 CSP 限制）。
   :not([multiple]) 抬高优先级，压过各处筛选区对 .input 的 padding 简写，保证右侧给箭头留位 */
select.input:not([multiple]) {
  -webkit-appearance: none; appearance: none;
  padding-right: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.input:not([multiple]):hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
select.input:not([multiple]):disabled { cursor: not-allowed; opacity: .7; }
/* 输入框与下拉框的焦点：边框变主色 + 柔和光晕，替换叠在圆角外的粗描边 */
/* 描边保留为透明而不是去掉：强制配色（高对比度）模式会把透明描边画成系统色，焦点仍然可见 */
.input:focus-visible { outline: 2px solid transparent; outline-offset: 1px; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 122, 85, .18); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
@media (forced-colors: active) {
  .input:focus-visible { outline-color: Highlight; }
  /* 高对比度模式下渐变箭头可能被去掉，退回系统自带的下拉箭头 */
  select.input:not([multiple]) { -webkit-appearance: auto; appearance: auto; background-image: none; }
}
.rail-item { width: 100%; color: inherit; }
.q-tag { display: inline-block; margin-right: 6px; padding: 0 6px; border: 1px solid var(--amber-line); border-radius: var(--r-s); background: var(--amber-bg); color: var(--amber); font-size: 11px; font-weight: 600; line-height: 16px; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-d); border-color: var(--red-d); }
.dialog { width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 16px); padding: 18px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); color: var(--text); box-shadow: var(--shadow-l); }
.dialog::backdrop { background: rgba(16, 48, 42, .35); }
.dialog h2 { font-size: 15px; font-weight: 600; }
.dialog p { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.dialog .field-label { margin-top: 10px; }
.dialog .field-error { color: var(--red); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.hist { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.hist-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.queue-head h2:focus { outline: none; }
/* 筛选区统一规格：第 1-2 行日期范围（标签在上、两列等宽），第 3 行其余条件两两一行，
   第 4 行“筛选/查找”主按钮 + “清除”文字按钮；输入框与按钮同为 34px 高 */
.hist-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 8px; }
.hist-filter .field-label { grid-row: 1; margin: 0; font-size: 12px; }
.hist-filter .input { grid-row: 2; min-width: 0; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.hist-filter > .btn { grid-row: 4; min-height: 34px; margin-top: 6px; }
.hist-more { display: flex; width: 100%; margin-top: 6px; }
.hist-filter .hist-filter-extra { grid-row: 3; grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 8px; margin-top: 6px; }
.hist-filter .hist-filter-extra .field-label, .hist-filter .hist-filter-extra .input { grid-row: auto; }
.hist-filter .hist-filter-extra .field-label { margin-bottom: 2px; }
.hist-field { min-width: 0; }
.hist-field-wide { grid-column: 1 / -1; }
.cust-filter .field-label, .cust-filter .input { grid-column: 1 / -1; }
.cust-filter > .btn { grid-row: 3; }
.hist .chat-actions .btn { width: auto; padding: 0 9px; }
#staff-history-meta { display: block; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .rail-item { width: auto; }
  .ws-top { flex-wrap: wrap; gap: 4px 10px; }
  .ws-top-actions { flex-wrap: wrap; gap: 6px; }
  .hist { display: flex; flex-direction: column; }
  .hist-side { flex: 1; border-right: 0; }
  .hist[data-view="list"] .center { display: none; }
  .hist[data-view="detail"] .hist-side { display: none; }
  .hist .center { flex: 1; min-height: 0; }
  .ws[data-view] .hist[data-view="detail"] .center { display: flex; }
  .hist .chat-actions .btn { min-height: 38px; font-size: 13px; }
  .dialog select.input { font-size: 16px; }
}
@media (max-width: 1180px) {
  .rail-item { width: 54px; }
}
@media (max-width: 720px) {
  .rail-item { width: auto; }
  .hist-filter .input { min-height: 38px; font-size: 16px; }
  .hist-filter > .btn { min-height: 38px; }
}
@media (max-height: 520px) {
  .ws-top-title { display: none; }
  .queue-head { padding: 6px 10px; }
  .hist-filter .input, .hist-filter > .btn { min-height: 30px; }
}

/* ———— 账号：个人资料弹层与管理后台，沿用工作台的墨绿与卡片语言 ———— */
.ad-status { margin-top: 8px; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.ad-status:empty { display: none; }
.ad-status[data-state="ok"] { color: var(--green-d); }
.ad-status[data-state="bad"] { color: var(--red); }
.dialog input.input:disabled { background: #f1efea; color: var(--text-3); cursor: not-allowed; }
.login-form .btn + .btn { margin-top: 8px; }
.ad-body { --ad-header-height: 56px; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.ad-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--ink); color: var(--on-ink-2); }
.ad-body[data-page="admin"] .ad-top { position: sticky; top: 0; z-index: 2; min-height: var(--ad-header-height); }
.ad-top #admin-logout { color: var(--ink); }
.ad-top :focus-visible { outline-color: #9fe3c6; }
.ad-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ad-brand .brand-mark { width: 30px; height: 30px; flex: none; }
.ad-brand strong { display: block; color: #fff; font: 600 15px/1.3 var(--latin); }
.ad-brand small { display: block; font-size: 12px; line-height: 1.4; }
.ad-shell { flex: 1; display: grid; grid-template-columns: 188px minmax(0, 1fr); background: var(--panel); }
.ad-nav { position: sticky; top: var(--ad-header-height); align-self: start; display: grid; gap: 4px; padding: 18px 12px; }
.ad-nav-label { padding: 0 10px 5px; color: var(--text-2); font-size: 12px; }
.ad-nav .btn { justify-content: flex-start; border-color: transparent; background: transparent; text-align: left; white-space: nowrap; }
.ad-nav .btn:hover, .ad-nav .btn[aria-current="page"] { background: var(--green-bg); color: var(--green-d); }
.ad-nav .btn[aria-current="page"] { font-weight: 600; }
.ad-main { min-width: 0; padding: 22px clamp(16px, 3vw, 36px); border-left: 1px solid var(--line); background: var(--canvas); }
.ad-main > .ad-card { max-width: 1280px; margin-inline: auto; }
.ad-drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(440px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; padding: 22px; border-radius: 0; overscroll-behavior: contain; }
.ad-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); box-shadow: var(--shadow); }
.ad-card h1, .ad-card h2 { color: var(--ink); font-size: 15px; font-weight: 600; }
.ad-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ad-hint { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.ad-table-wrap { margin-top: 10px; overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ad-table th, .ad-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.ad-table th { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.ad-table tbody tr:last-child td { border-bottom: 0; }
.ad-muted { color: var(--text-3); }
.ad-table .ad-action { white-space: nowrap; overflow-wrap: normal; }
.ad-disable-account { color: var(--text); overflow-wrap: anywhere; }
#admin-disable-dialog:focus { outline: none; }
.ad-form { margin-top: 12px; }
.ad-form .input { margin-bottom: 10px; }
.ad-form .ad-status { margin: 0 0 10px; }
.ad-form .input + .ad-hint, .ad-form .field-error { margin: -6px 0 10px; }
.ad-form .input[aria-invalid="true"] { border-color: var(--red); }
.ad-form .btn { width: 100%; }
.ad-customers { grid-column: 1 / -1; }
.ad-customers h3 { margin-top: 12px; color: var(--ink); font-size: 14px; font-weight: 600; }
.ad-customers h3:focus { outline: none; }
.ad-customers .ad-table { min-width: 520px; }
.ad-customers td.num { white-space: nowrap; overflow-wrap: normal; }
.ad-customers td.ad-customer-body { min-width: 16em; white-space: pre-wrap; }
.ad-customer-identity { margin-top: 10px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel-2); }
.ad-customer-identity .kv { border-bottom: 0; }
.ad-customer-identity .kv + .kv { border-top: 1px solid var(--line); }
/* 客户目录与黑名单：工具栏、状态标签、分页；详情在右侧抽屉 */
.ad-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; }
.ad-tool { flex: 1 1 160px; min-width: 0; max-width: 260px; }
.ad-tool .field-label { font-size: 12px; color: var(--text-2); }
.ad-tool .input { min-height: 34px; padding: 5px 9px; }
.ad-tool-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-tool-actions .btn { min-height: 34px; }
/* 选项很少的筛选下拉（黑名单状态）不必拉满一格 */
.ad-tool:has(> #admin-directory-blocked) { flex: 0 1 150px; }
.ad-pager { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.ad-pager:not(:has(> :not([hidden]))) { display: none; }
.ad-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: rgba(16, 48, 42, .06); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.ad-tag.is-blocked { background: var(--red-bg); color: var(--red); }
.ad-customer-drawer { width: min(600px, 100%); }
.ad-customer-drawer .ad-card-head { align-items: flex-start; }
.ad-customer-drawer .ad-card-head .ad-hint { margin: 0; font-size: 12px; }
.ad-customers h2:focus { outline: none; }
.ad-customer-drawer #admin-customer-back { margin-top: 12px; }
/* 行操作直出：按钮在单元格内换行，不撑宽页面；表格本身仍在 .ad-table-wrap 内横向滚动 */
.ad-table td.ad-row-action { min-width: 13em; white-space: normal; }
.ad-row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.ad-table .ad-block-actor { min-width: 7em; }
.ad-table .ad-block-reason { min-width: 12em; max-width: 28em; white-space: pre-wrap; }
.ad-row-actions .btn { min-height: 30px; padding: 0 8px; font-size: 12px; }
.ad-danger-text, .ad-body .ad-row-actions .ad-danger-text { color: var(--red); }
.ad-owner-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 22em; }
.ad-owner-editor select.input { flex: 1 1 10em; min-width: 0; max-width: 100%; }
.ad-owner-editor .ad-hint, .ad-owner-editor .ad-status { flex-basis: 100%; margin: 0; font-size: 12px; }
#admin-block-dialog:focus { outline: none; }
@media (pointer: coarse) {
  .ad-row-actions .btn, .ad-owner-editor .btn, .ad-owner-editor select.input { min-height: 44px; }
}

/* ———— 工作台：客户归属与内部备注，全部限定在 .internal 内 ———— */
.internal { border-top: 1px solid var(--line); }
.internal-history { flex: none; padding: 10px 16px; background: var(--panel-2); }
.internal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.internal h3 { font-size: 13px; font-weight: 600; }
.internal h4 { margin: 10px 0 4px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.internal-owner { padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); }
.internal-owner .kv:last-child { border-bottom: 0; }
.internal-empty { padding: 6px 0; color: var(--text-2); font-size: 13px; }
.internal-notes { max-height: min(36vh, 320px); overflow-y: auto; }
.internal-note { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.internal-note:last-child { border-bottom: 0; }
.internal-note-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; color: var(--text-3); font-size: 12px; }
.internal-note-author { color: var(--text-2); font-weight: 500; overflow-wrap: anywhere; }
.internal-note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.internal-form { margin-top: 10px; padding: 8px; border: 1px solid var(--amber-line); border-radius: var(--r-m); background: var(--amber-bg); }
.internal-form .composer-input { display: block; width: 100%; min-height: 62px; max-height: 160px; }
.internal-form-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.internal-count { color: var(--text-2); font-size: 12px; }
.internal-count[data-over="true"] { color: var(--red); }
/* ———— 客户操作：拉黑本人客户。区块与弹窗只在服务端确认归属后出现 ———— */
.block-sec { display: grid; gap: 6px; border-top: 1px solid var(--line); }
.block-sec h3 { font-size: 13px; font-weight: 600; }
.block-sec .btn { justify-self: start; }
#staff-block-dialog .composer-input { display: block; width: 100%; min-height: 72px; max-height: 180px; margin-top: 4px; }
#staff-block-dialog .internal-count { margin-top: 4px; text-align: right; }
/* ———— 附件：选择、上传状态与消息卡片。图片框定高，加载前后不改变滚动位置 ———— */
.attach-btn { flex: none; width: 38px; min-height: 38px; padding: 0; }
.cl-body .attach-btn { width: 42px; min-height: 42px; }
.attach-hint { padding: 8px 12px 0; border-top: 1px solid var(--line); background: var(--panel); color: var(--text-2); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.cl-body .attach-hint { background: rgba(255, 252, 248, .42); }
.attach-hint:not([hidden]) + .composer { border-top: 0; }
.upload { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.ws-composer .upload { margin-top: 8px; padding: 6px 0 0; }
.upload-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 8px; }
.upload-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.upload-state { color: var(--text-2); }
.attachment { display: flex; flex-direction: column; gap: 6px; width: 240px; max-width: 100%; }
.attachment-image { display: block; width: 100%; height: 160px; object-fit: contain; border-radius: var(--r-s); background: var(--panel-2); }
.attachment-preview { display: block; width: 100%; border-radius: var(--r-s); cursor: zoom-in; }
/* 大图：铺满视口的透明 dialog，图片按原比例缩到可见区内、不放大；空白处即遮罩 */
.image-viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: max(48px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); border: 0; background: transparent; overscroll-behavior: contain; }
.image-viewer[open] { display: flex; align-items: center; justify-content: center; }
.image-viewer::backdrop { background: rgba(16, 48, 42, .82); }
.cl-body .image-viewer::backdrop { background: rgba(59, 36, 23, .82); }
.image-viewer-image { display: block; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: var(--r-s); background: var(--panel); box-shadow: var(--shadow-l); }
.image-viewer-close { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
/* 多图：底部居中的切换条，图片区让出同等高度，不与关闭按钮或图片重叠；横滑只在图片上，竖向平移与缩放留给浏览器 */
.image-viewer.is-gallery { padding-bottom: calc(max(10px, env(safe-area-inset-bottom)) + 56px); }
.image-viewer-image { touch-action: pan-y pinch-zoom; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.image-viewer-nav { position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); padding: 4px; border-radius: var(--r-m); background: var(--panel); box-shadow: var(--shadow); }
.image-viewer-count { min-width: 4.5em; color: var(--text); font-size: 13px; text-align: center; white-space: nowrap; }
.attachment-info { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.attachment-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.attachment-size { font-size: 12px; opacity: .8; }
.attachment-state { font-size: 13px; opacity: .85; }
.attachment-link { margin-left: auto; color: var(--text); text-decoration: none; }
/* ———— 表情：按钮上方的 fixed 浮层，不占布局；位置与尺寸由脚本按可见视口写入变量 ———— */
.emoji-btn { flex: none; width: 38px; min-height: 38px; padding: 0; font-size: 18px; line-height: 1; }
.cl-body .emoji-btn { width: 42px; min-height: 42px; }
.emoji-panel { position: fixed; z-index: 60; left: 0; top: 0; transform: translate(var(--emoji-x, 8px), var(--emoji-y, 8px)); width: var(--emoji-w, min(320px, calc(100vw - 16px))); max-height: var(--emoji-max-h, 50vh); padding: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line-2); border-radius: var(--r-m); background: #fff; color: var(--text); box-shadow: var(--shadow-l); }
.cl-body .emoji-panel { border-color: var(--glass-edge); background: rgba(255, 250, 245, .97); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; }
.emoji-choice { min-height: 38px; border-radius: var(--r-s); font-size: 22px; line-height: 1; }
.emoji-choice:hover { background: var(--panel-2); }
.cl-body .emoji-choice:hover { background: var(--green-bg); }
@media (max-width: 860px) {
  .ad-main { padding: 12px; }
  .ad-top { padding: 8px 12px; }
}
@media (max-width: 620px) {
  .ad-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .ad-nav { z-index: 1; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
  .ad-nav-label { display: none; }
  .ad-nav .btn { padding-inline: 8px; }
  .ad-main { border-left: 0; }
  .ad-drawer .input, .ad-tool .input { font-size: 16px; }
  .ad-tool, .ad-tool:has(> #admin-directory-blocked) { flex-basis: 100%; max-width: none; }
  .ad-customer-drawer { padding: 16px 12px; }
  .ad-owner-editor select.input { font-size: 16px; }
}
/* ———— 管理后台 · 柔和玻璃（只覆盖 .ad-body 与管理员登录页，工作台、访客窗不受影响） ———— */
:is(.ad-body, [data-page="admin-login"]) {
  --canvas: #eef3ef; --panel: rgba(255, 255, 255, .66); --panel-2: rgba(255, 255, 255, .5);
  --line: rgba(16, 48, 42, .09); --line-2: rgba(16, 48, 42, .17);
  --text: #10302a; --text-2: #46625a; --text-3: #5d736c;
  --glass-edge: rgba(255, 255, 255, .78); --glass-blur: blur(18px) saturate(130%);
  --r-s: 8px; --r-m: 12px; --r-l: 22px;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 10px 30px rgba(16, 48, 42, .08);
  --shadow-l: 0 4px 12px rgba(16, 48, 42, .1), 0 32px 72px rgba(16, 48, 42, .22);
}
.ad-body, [data-page="admin-login"] .gate {
  background:
    radial-gradient(52% 46% at 12% 0%, rgba(206, 238, 222, .95), transparent 70%) no-repeat,
    radial-gradient(46% 50% at 100% 100%, rgba(246, 228, 208, .9), transparent 70%) no-repeat,
    radial-gradient(40% 40% at 88% 8%, rgba(220, 238, 246, .7), transparent 70%) no-repeat,
    #eef3ef;
  background-attachment: fixed;
}
/* 按钮、字段 */
:is(.ad-body, [data-page="admin-login"]) .btn { border-color: var(--line-2); background: rgba(255, 255, 255, .82); box-shadow: 0 1px 2px rgba(16, 48, 42, .06); }
:is(.ad-body, [data-page="admin-login"]) .btn:hover:not(:disabled) { border-color: rgba(16, 48, 42, .26); background: #fff; }
:is(.ad-body, [data-page="admin-login"]) .btn:disabled { border-color: var(--line); background: rgba(255, 255, 255, .45); color: #6f817b; box-shadow: none; }
:is(.ad-body, [data-page="admin-login"]) .btn-primary { border-color: var(--green-d); background: linear-gradient(180deg, #13895f, var(--green)); color: #fff; box-shadow: 0 6px 14px rgba(15, 122, 85, .24), inset 0 1px 0 rgba(255, 255, 255, .22); }
:is(.ad-body, [data-page="admin-login"]) .btn-primary:hover:not(:disabled) { border-color: var(--green-d); background: var(--green-d); }
.ad-body .btn-danger { border-color: var(--red-d); background: var(--red); color: #fff; box-shadow: 0 6px 14px rgba(173, 51, 42, .2); }
.ad-body .btn-danger:hover:not(:disabled) { border-color: var(--red-d); background: var(--red-d); }
:is(.ad-body, [data-page="admin-login"]) .input { border-color: var(--line-2); background-color: rgba(255, 255, 255, .86); }
:is(.ad-body, [data-page="admin-login"]) .input:disabled, .ad-body .dialog input.input:disabled { background-color: rgba(255, 255, 255, .45); color: var(--text-3); }

/* 顶栏与通知 */
.ad-body .ad-top { border-bottom: 1px solid var(--line); background: rgba(238, 243, 239, .72); color: var(--text-2); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.ad-body .ad-top :focus-visible { outline-color: var(--green); }
.ad-body .ad-brand .brand-mark { filter: drop-shadow(0 4px 8px rgba(15, 122, 85, .25)); }
.ad-body .ad-brand strong { color: var(--ink); }
.ad-body > .notice { margin: 12px clamp(12px, 2vw, 24px) 0; border: 1px solid var(--line); border-radius: var(--r-m); }
.ad-body > .notice.wait { border-color: var(--amber-line); }
.ad-body > .notice.bad { border-color: var(--red-line); }
.ad-body > .notice.ok { border-color: #cae4d6; }

/* 外框：悬浮侧栏 + 透明主区 */
.ad-body .ad-shell { gap: 18px; padding: 16px clamp(12px, 2vw, 24px) 28px; grid-template-columns: 212px minmax(0, 1fr); background: transparent; }
.ad-body .ad-nav { top: calc(var(--ad-header-height) + 16px); gap: 4px; padding: 14px 10px; border: 1px solid var(--glass-edge); border-radius: var(--r-l); background: rgba(255, 255, 255, .52); box-shadow: var(--shadow); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.ad-body .ad-nav-label { padding: 0 12px 6px; color: var(--text-3); font-size: 12px; letter-spacing: .06em; }
.ad-body .ad-nav .btn { min-height: 40px; padding: 0 12px; border-color: transparent; border-radius: var(--r-m); background: transparent; color: var(--text-2); box-shadow: none; }
.ad-body .ad-nav .btn:not([aria-current="page"]):hover { border-color: transparent; background: rgba(255, 255, 255, .78); color: var(--ink); }
.ad-body .ad-nav .btn[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: #fff; box-shadow: 0 8px 20px rgba(16, 48, 42, .24); }
.ad-body .ad-nav .btn[aria-current="page"]:focus-visible { outline-offset: 3px; }
.ad-body .ad-main { padding: 0; border-left: 0; background: transparent; }

/* 卡片 */
.ad-body .ad-card { padding: 22px; border-color: var(--glass-edge); background: var(--panel); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.ad-body .ad-card-head { flex-wrap: wrap; gap: 10px; }
.ad-body .ad-card h1, .ad-body .ad-card h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; }
.ad-body .ad-hint { margin-top: 6px; }
.ad-body .src-card { margin-top: 14px; padding: 14px 16px; border-color: var(--line); border-radius: 16px; background: rgba(255, 255, 255, .5); }
.ad-body .ad-customer-identity { margin-top: 14px; border-radius: 16px; background: rgba(255, 255, 255, .5); }

/* 筛选与标签页：胶囊分段器；选中项由脚本切换 btn-primary，这里统一改成白色浮起 */
.ad-body .src-lookup-form:is([role="group"], [role="tablist"]) { display: inline-flex; max-width: 100%; margin-top: 14px; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(16, 48, 42, .06); }
.ad-body .src-lookup-form:is([role="group"], [role="tablist"]) .btn { min-height: 32px; padding: 0 14px; border-color: transparent; border-radius: 999px; background: transparent; color: var(--text-2); box-shadow: none; }
.ad-body .src-lookup-form:is([role="group"], [role="tablist"]) .btn:not([aria-pressed="true"]):not([aria-selected="true"]):hover:not(:disabled) { border-color: transparent; background: rgba(255, 255, 255, .6); color: var(--ink); }
.ad-body .src-lookup-form:is([role="group"], [role="tablist"]) .btn:is([aria-pressed="true"], [aria-selected="true"]) { border-color: transparent; background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 2px 8px rgba(16, 48, 42, .12); }
.ad-body .src-lookup-form:is([role="group"], [role="tablist"]) .btn:disabled { color: #6f817b; }

/* 表格：圆角外框落在 table 上，表格隐藏时不会留下空框 */
.ad-body .ad-table-wrap { margin-top: 16px; }
.ad-body .ad-table { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .55); }
.ad-body .ad-table th, .ad-body .ad-table td { padding: 11px 14px; border-bottom-color: var(--line); }
.ad-body .ad-table th { background: rgba(16, 48, 42, .035); color: var(--text-3); font-size: 12px; font-weight: 500; }
.ad-body .ad-table tbody tr:hover td { background: rgba(255, 255, 255, .7); }
.ad-body .ad-table thead th:first-child { border-top-left-radius: 15px; }
.ad-body .ad-table thead th:last-child { border-top-right-radius: 15px; }
.ad-body .ad-table tbody tr:last-child td:first-child { border-bottom-left-radius: 15px; }
.ad-body .ad-table tbody tr:last-child td:last-child { border-bottom-right-radius: 15px; }
.ad-body .ad-table .input { min-height: 32px; }

/* 弹窗与抽屉 */
:is(.ad-body, [data-page="admin-login"]) .dialog { padding: 22px; border-color: var(--glass-edge); background: rgba(248, 251, 249, .94); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
:is(.ad-body, [data-page="admin-login"]) .dialog::backdrop { background: rgba(16, 48, 42, .28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.ad-body .ad-drawer { border-width: 0 0 0 1px; border-radius: 24px 0 0 24px; }

/* 管理员登录页 */
[data-page="admin-login"] .state-card { padding: 28px; border-color: var(--glass-edge); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow-l), inset 0 1px 0 rgba(255, 255, 255, .85); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
[data-page="admin-login"] .login-brand .brand-mark { width: 38px; height: 38px; filter: drop-shadow(0 4px 10px rgba(15, 122, 85, .28)); }
[data-page="admin-login"] .login-brand h1 { font-size: 20px; font-weight: 700; }
[data-page="admin-login"] .login-form .input { min-height: 42px; }
[data-page="admin-login"] .login-form .btn { min-height: 42px; }

@media (max-width: 860px) {
  .ad-body .ad-shell { gap: 12px; padding: 12px 12px 20px; grid-template-columns: 180px minmax(0, 1fr); }
  .ad-body .ad-card { padding: 16px; border-radius: 18px; }
}
@media (max-width: 620px) {
  .ad-body .ad-shell { grid-template-columns: minmax(0, 1fr); }
  .ad-body .ad-nav { top: calc(var(--ad-header-height) + 8px); padding: 6px; border-radius: 18px; background: rgba(255, 255, 255, .78); }
  .ad-body .ad-nav .btn { min-height: 36px; }
  .ad-body .src-lookup-form:is([role="group"], [role="tablist"]) { border-radius: 18px; }
  .ad-body .ad-drawer { border-width: 0; border-radius: 0; }
  [data-page="admin-login"] .state-card { padding: 22px; }
}
/* 系统要求降低透明度或浏览器不支持毛玻璃时，改用接近不透明的面板，保证文字对比 */
@media (prefers-reduced-transparency: reduce) {
  :is(.ad-body, [data-page="admin-login"]) { --panel: #fff; --panel-2: #f7faf8; }
  :is(.ad-body, [data-page="admin-login"]) :is(.ad-top, .ad-nav, .ad-card, .state-card, .dialog) { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ad-body .ad-top { background: #eef3ef; }
  .ad-body .ad-nav { background: #fff; }
  :is(.ad-body, [data-page="admin-login"]) .dialog { background: #fff; }
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :is(.ad-body, [data-page="admin-login"]) { --panel: rgba(255, 255, 255, .92); }
  .ad-body .ad-top { background: rgba(238, 243, 239, .97); }
  .ad-body .ad-nav { background: rgba(255, 255, 255, .9); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
