/* 维护说明：客服工作台独立样式；俱乐部切换层独立于聊天滚动区，避免下拉被会话面板裁剪。 */
:root {
  color-scheme: light;
  --ink: #242728;
  --muted: #717678;
  --line: #e8eaea;
  --soft: #f5f6f6;
  --accent: #426b60;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #fff; font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
.hidden { display: none !important; }
h1, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fff; cursor: pointer; transition: background .15s ease; }
button:hover { background: var(--soft); }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select, textarea { min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid #dcdede; border-radius: 6px; color: var(--ink); background: #fff; }
input::placeholder, textarea::placeholder { color: #858a8b; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.primary-button, .login-form button { border-color: var(--ink); color: #fff; background: var(--ink); font-weight: 500; }
.primary-button:hover, .login-form button:hover { background: #3b4041; }
.danger { color: #a44b46; }

.service-login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 64px 24px; }
.login-panel { width: min(352px, 100%); padding: 0; }
.login-eyebrow { margin-bottom: 26px; color: var(--muted); font-size: 12px; letter-spacing: 2px; }
.brand-block h1 { margin-bottom: 10px; font-size: 28px; font-weight: 600; letter-spacing: -1px; }
.brand-block > p:last-child { color: var(--muted); }
.login-form { display: grid; gap: 22px; margin-top: 36px; }
.login-form label { display: grid; gap: 8px; font-size: 13px; }
.login-form input { min-height: 48px; }
.login-form button { min-height: 48px; margin-top: 6px; }
.login-form .retry-login-clubs { margin-top: -14px; border-color: var(--line); color: var(--accent); background: #fff; }
.form-message { color: #a44b46; font-size: 13px; }
.form-message:empty { display: none; }
.login-note { margin-top: 24px; text-align: center; color: var(--muted); font-size: 12px; }
.admin-link { display: block; width: fit-content; margin: 40px auto 0; color: #606768; font-size: 12px; text-decoration: none; }
.admin-link:hover { text-decoration: underline; }
.admin-link span { margin-left: 6px; }

.service-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.service-topbar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 20px; min-height: 80px; padding: 16px 28px; border-bottom: 1px solid var(--line); }
.service-topbar h1 { font-size: 17px; font-weight: 600; }
.service-topbar p { margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.topbar-actions button { border-color: transparent; color: #606768; font-size: 13px; }
.service-layout[aria-busy="true"] { opacity: .55; pointer-events: none; }
.service-layout { display: grid; grid-template-columns: 352px minmax(0, 1fr); flex: 1; min-height: 0; }
.service-list-panel { min-width: 0; overflow-y: auto; padding: 24px 18px; border-right: 1px solid var(--line); background: #fcfcfc; }
.service-list-panel h3 { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 1px; }
.filter-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding-bottom: 22px; }
.filter-line select { width: 132px; min-height: 40px; font-size: 13px; }
.filter-line label { display: flex; align-items: center; gap: 5px; min-height: 40px; color: #616768; font-size: 12px; cursor: pointer; }
.filter-line input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.transfer-box { margin-bottom: 24px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.transfer-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; font-size: 12px; overflow-wrap: anywhere; }
.transfer-item > span:last-child { display: flex; gap: 6px; }
#sessionList { margin-top: 12px; }
.session-card { padding: 18px 12px; border-bottom: 1px solid var(--line); border-radius: 4px; overflow-wrap: anywhere; }
.session-card:hover { background: #f3f4f4; }
.session-card.active-card { background: #edf2ef; }
.session-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.session-head strong { font-size: 13px; font-weight: 600; }
.session-meta { color: var(--muted); font-size: 12px; line-height: 1.9; }
.session-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.table-action { min-height: 36px; padding: 5px 10px; background: transparent; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { color: #426b60; }
.badge.warning { color: #8b6c35; }
.badge.danger { color: #a44b46; }

.conversation-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 32px 24px; }
.conversation-panel > .empty { flex: 1; display: grid; place-items: center; }
.conversation-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; min-height: 76px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.conversation-head > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; overflow-wrap: anywhere; }
.conversation-head strong { font-size: 14px; font-weight: 600; }
.conversation-head > div:last-child, .conversation-head > div > span:last-child:not(.badge) { color: var(--muted); font-size: 12px; }
.message-list { flex: 1; min-height: 100px; overflow-y: auto; padding: 28px 4px; }
.service-message { display: flex; flex-direction: column; align-items: flex-start; width: fit-content; max-width: 76%; margin-bottom: 22px; }
.service-message.staff { margin-left: auto; align-items: flex-end; }
.service-message.system { margin-left: auto; margin-right: auto; align-items: center; }
.service-bubble { padding: 11px 15px; border-radius: 8px; color: var(--ink); background: #f2f3f3; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.staff .service-bubble { background: #edf2ef; }
.system .service-bubble { padding: 4px 8px; color: var(--muted); background: transparent; font-size: 12px; }
.service-time { margin-top: 6px; color: var(--muted); font-size: 10px; }
.service-action-row { display: flex; align-items: flex-end; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.service-action-row textarea { flex: 1; min-height: 80px; max-height: 180px; resize: vertical; }
.service-action-row .primary-button { min-width: 80px; min-height: 44px; }
.service-action-row.compact { flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border: 0; }
.service-action-row.compact select { width: 180px; min-height: 40px; padding: 8px; font-size: 12px; }
.service-action-row.compact button { font-size: 12px; }
.readonly-note { padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.empty.small { padding: 14px 0 0; text-align: left; font-size: 12px; }
.service-bubble.order-bubble { padding: 0; background: transparent; white-space: normal; }
.service-order-card { width: 300px; max-width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; }
.service-order-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.service-order-head strong { color: var(--ink); font-weight: 500; }
.service-order-title { padding: 14px 14px 0; font-size: 14px; font-weight: 500; }
.service-order-card dl { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px 12px; margin: 14px; }
.service-order-card dt { color: var(--muted); }
.service-order-card dd { margin: 0; overflow-wrap: anywhere; }
.service-order-foot { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--accent); }
.service-order-card.missing { padding: 14px; }
.toast { position: fixed; bottom: 28px; left: 50%; z-index: 20; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 6px; color: #fff; background: #303536; font-size: 13px; }

@media (max-width: 1100px) {
  .service-layout { grid-template-columns: 310px minmax(0, 1fr); }
  .conversation-panel { padding: 0 20px 20px; }
}
@media (max-width: 760px) {
  .service-shell { height: auto; min-height: 100dvh; }
  .service-topbar { padding: 16px; gap: 12px; flex-wrap: wrap; }
  .topbar-actions { margin-left: auto; }
  .service-topbar h1 { font-size: 16px; }
  .topbar-actions { gap: 0; }
  .topbar-actions button { padding: 8px 10px; }
  .service-layout { display: flex; flex-direction: column; }
  .service-list-panel { max-height: 42vh; min-height: 220px; padding: 18px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .filter-line { padding-bottom: 12px; }
  .transfer-box { margin-bottom: 16px; padding: 12px 0; }
  .conversation-panel { min-height: 58vh; padding: 0 16px 24px; }
  .conversation-head { flex-direction: column; align-items: flex-start; }
  .message-list { flex: none; height: 45vh; min-height: 260px; padding: 22px 0; }
  .service-message { max-width: 90%; }
  .service-action-row { gap: 8px; }
  .service-action-row textarea { font-size: 16px; }
  .service-action-row .primary-button { min-width: 64px; }
  .service-action-row.compact { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service-action-row.compact select { grid-column: 1 / -1; width: 100%; }
  .service-action-row.compact button { padding: 8px 4px; }
  button, .table-action { min-height: 44px; }
  .login-form input, .login-form select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
