* {
  box-sizing: border-box;
}

html.kefu-user-root,
html.kefu-user-root body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #eef4ff;
  color: #1a2b4b;
}

.hidden {
  display: none !important;
}

.chat-app,
.staff-layout {
  max-width: 1300px;
  margin: 0 auto;
  min-height: 100vh;
}

.user-app {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  --user-top-offset: calc(64px + env(safe-area-inset-top, 0px));
}

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

.messages.user-messages {
  padding-top: calc(var(--user-top-offset, 64px) + 18px);
  padding-bottom: 106px;
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 -10px 30px -12px rgb(0 0 0 / 25%);
}

.user-msg-block {
  width: 100%;
}

.user-messages .user-msg-time,
#staffMessages .staff-msg-time {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #7a8bb3;
  margin: 2px 0 8px;
  user-select: none;
  line-height: 1.35;
}

.staff-msg-block {
  width: 100%;
}

.user-app .user-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-left: 10px;
  padding-right: 12px;
  padding-bottom: 10px;
  background: linear-gradient(135deg, #1a5fd8 0%, #1d6fff 48%, #3b8cff 100%);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.18);
}

.user-top-bar__inner {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 720px;
  min-height: 44px;
  margin: 0 auto;
}

.user-top-back {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.user-top-back:not([hidden]) {
  display: flex;
}

.user-top-back[hidden] {
  display: none !important;
}

.user-top-back:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.26);
}

.user-top-brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(72vw, 260px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  pointer-events: none;
}

.user-top-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.user-top-sub {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.user-top-bar .user-top-status {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1;
  padding: 6px 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}

.user-top-bar .user-top-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.95;
  flex-shrink: 0;
}

.user-top-bar .user-top-status.online {
  background: rgba(22, 163, 74, 0.92);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.4);
}

.user-top-bar .user-top-status.offline {
  background: rgba(15, 23, 42, 0.2);
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
}

.user-composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 15px;
  z-index: 30;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: transparent;
  border-top: none;
  box-shadow: none;
}

.user-composer-preview {
  margin: 0 4px 8px;
  max-height: 72px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}

.user-composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
}

.user-composer-attach {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.user-composer-file-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}

.user-composer-attach:active {
  transform: scale(0.96);
  background: #f1f5f9;
}

.user-composer-attach-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.user-composer-input-wrap {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 2px 4px;
}

.user-composer-input-wrap textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 132px;
  padding: 10px 12px;
  margin: 0;
  border: 0;
  border-radius: 20px;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.45;
  font-family: inherit;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.user-composer-input-wrap textarea::placeholder {
  color: #94a3b8;
}

.user-composer-send {
  flex-shrink: 0;
  min-width: 48px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #3b82f6 0%, #1d6fff 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(29, 111, 255, 0.35);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease,
    filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.user-composer-send-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  color: inherit;
  user-select: none;
  -webkit-user-select: none;
}

.user-composer-send:hover:not(:disabled) {
  filter: brightness(1.05);
}

.user-composer-send:active:not(:disabled) {
  transform: scale(0.98);
}

.user-composer-send:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
  opacity: 1;
}

.user-composer-hint {
  margin: 6px 4px 0;
  font-size: 11px;
  color: #64748b;
  text-align: center;
  line-height: 1.35;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.user-composer.is-locked {
  opacity: 0.72;
  pointer-events: none;
  filter: grayscale(0.15);
}

.user-alert-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.user-alert-modal[hidden] {
  display: none !important;
}

.user-alert-modal__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.user-alert-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  padding: 20px 20px 16px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
}

.user-alert-modal__message {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.55;
  color: #1e293b;
  text-align: center;
}

.user-alert-modal__ok {
  display: block;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #1d6fff 100%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.user-alert-modal__ok:active {
  filter: brightness(0.96);
}

.top-bar {
  padding: 13px 16px;
  background: #1d6fff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar h1 {
  margin: 0;
  font-size: 16px;
}
.chat-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sub-line {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.status {
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.status.online {
  background: #22c55e;
}

.status.offline {
  background: #ef4444;
}

.messages {
  flex: 1;
  padding: 16px;
  padding-bottom: 130px;
  overflow-y: auto;
  background: #f5f8ff;
  max-height: calc(100vh - 200px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.messages::-webkit-scrollbar {
  display: none;
}
.chat-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 0;
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: #f5f8ff;
}
.msg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  animation: msgIn 0.24s ease;
}
.msg-row.mine {
  justify-content: flex-end;
}
.msg-row.mine .avatar {
  order: 2;
}

.msg {
  width: fit-content;
  max-width: min(68vw, 620px);
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: break-word;
  box-shadow: 0 4px 10px rgba(33, 85, 180, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.msg-recalled {
  opacity: 0.72;
  font-style: italic;
}
.msg:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(33, 85, 180, 0.12);
}

.msg.user {
  background: #1d6fff;
  color: #fff;
}

.msg.staff {
  background: #e4ecff;
}

.msg.system {
  background: #fff7e6;
  color: #7a5200;
}

/* 仅图片、无文字：不显示气泡底与阴影，只保留图片圆角 */
.msg.msg--media-only {
  background: transparent !important;
  color: inherit;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}
.msg.msg--media-only:hover {
  transform: none;
  box-shadow: none;
}
.msg.msg--media-only .msg-images {
  margin-top: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dbe8ff;
  border: 1px solid #c5d8ff;
}
.avatar-sm {
  width: 38px;
  height: 38px;
}
.avatar-xs {
  width: 24px;
  height: 24px;
}
.user-item-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msg-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msg-meta {
  font-size: 14px;
  color: #5f6f9a;
  margin: 0 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
.msg-meta-name {
  font-weight: 400;
}
.msg-meta-time {
  font-size: 11px;
  color: #7a8bb3;
  user-select: none;
  font-weight: 400;
}
.msg-row.mine .msg-meta {
  justify-content: flex-end;
  text-align: right;
}
.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.user-quick-keywords {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 8px;
}

.user-quick-kw-link {
  display: block;
  width: 100%;
  color: #1d6fff;
  font-size: 15px;
  line-height: 1.45;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  word-break: break-word;
}

.user-quick-kw-link:hover:not(.is-disabled) {
  color: #0b4fd4;
}

.user-quick-kw-link.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.msg-connect-footer {
  margin-top: 10px;
}

.msg-quick-kw-staff {
  margin-top: 8px;
  font-size: 12px;
  color: #5f6f9a;
  line-height: 1.45;
}

.msg-images {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.msg-img {
  max-width: min(260px, 78vw);
  min-height: 40px;
  border-radius: 8px;
  cursor: zoom-in;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.04);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.kefu-img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  box-sizing: border-box;
}
.kefu-img-lightbox[hidden] {
  display: none !important;
}
.kefu-img-lightbox__close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(8px + env(safe-area-inset-right, 0px));
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.kefu-img-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}
.kefu-img-lightbox__close:active {
  transform: scale(0.94);
}
.kefu-img-lightbox__close:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.kefu-img-lightbox__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 52px 12px 16px;
  box-sizing: border-box;
}
.kefu-img-lightbox__img {
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
  touch-action: pinch-zoom pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}
.msg-time {
  font-size: 11px;
  color: #7a8bb3;
  margin: 0 2px;
  text-align: right;
  user-select: none;
}

.input-bar {
  padding: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #d8e5ff;
  background: #fff;
}
.chat-input-bar {
  position: absolute;
  bottom: 0;
  margin: 0 12px 5px;
  left: 0;
  right: 0;
  border: 1px solid #d8e5ff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(29, 111, 255, 0.15);
  z-index: 20;
  align-items: flex-end;
}
.chat-input-bar.staff-composer {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  align-items: stretch;
}
.staff-composer-surface {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  padding: 10px 10px 8px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(29, 111, 255, 0.16);
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(29, 111, 255, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.75) inset;
}
.staff-composer.input-bar {
  padding: 0 2px 2px;
  gap: 0;
  border-top: none;
  background: transparent;
}
.staff-composer-preview {
  margin: 0 2px 8px;
  max-height: 88px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
}
.staff-composer-input-area {
  margin: 0 2px 10px;
  min-width: 0;
  background: rgba(245, 248, 255, 0.96);
  border-radius: 14px;
  border: 1px solid rgba(91, 140, 255, 0.2);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 2px 4px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.staff-composer-input-area:focus-within {
  border-color: rgba(29, 111, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(29, 111, 255, 0.12);
}
.staff-composer-input-area textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 160px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.5;
  font-family: inherit;
  background: transparent;
  color: #1a2b4b;
  -webkit-appearance: none;
  appearance: none;
}
.staff-composer-input-area textarea::placeholder {
  color: #7a8bb3;
}
.staff-composer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 0;
  min-height: 48px;
}
.staff-composer-toolbar-spacer {
  flex: 1;
  min-width: 8px;
}
.staff-composer-attach {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(29, 111, 255, 0.12);
  border: 1px solid rgba(29, 111, 255, 0.12);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.staff-composer-attach:hover {
  background: #eef4ff;
  color: #1d6fff;
  box-shadow: 0 2px 8px rgba(29, 111, 255, 0.16);
}
.staff-composer-attach:active {
  transform: scale(0.96);
}
.staff-composer-file-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}
.staff-composer-attach-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.staff-system-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #3c5aa8;
  background: rgba(220, 232, 255, 0.85);
  border: 1px solid rgba(91, 140, 255, 0.25);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.staff-system-tip input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #1d6fff;
  cursor: pointer;
}
.staff-composer-send {
  flex-shrink: 0;
  min-width: 72px;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #3b82f6 0%, #1d6fff 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(29, 111, 255, 0.35);
  transition:
    filter 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.staff-composer-send:hover:not(:disabled) {
  filter: brightness(1.05);
}
.staff-composer-send:active:not(:disabled) {
  transform: scale(0.98);
}
.staff-composer-send:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}
.staff-composer-send-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}
.chat-input-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.msg-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}
.pending-img-wrap {
  position: relative;
  display: inline-flex;
}
.pending-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #bfd3ff;
}
.pending-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #b91c1c;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.btn-pick-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e5edff;
  color: #1d4ed8;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}
.btn-pick-img:hover {
  background: #dbe4ff;
}

.input-bar:not(.staff-composer) input,
.input-bar:not(.staff-composer) textarea {
  flex: 1;
  padding: 14px 12px;
  border: 1px solid #bfd3ff;
  border-radius: 8px;
  outline: none;
  min-height: 52px;
  font-size: 16px;
  resize: vertical;
  font-family: inherit;
}

.input-bar button:not(.staff-composer-send),
.toggle-btn,
.danger-btn,
#loginBtn {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  background: #1d6fff;
  color: #fff;
}

.danger-btn {
  background: #e23b3b;
}
.icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 14px;
  line-height: 28px;
  text-align: center;
}

.staff-layout {
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  min-height: 100vh;
  align-items: stretch;
  background: #eef2f8;
}

.staff-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.staff-sidebar.sidebar {
  border-right: none;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.06);
}

.staff-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 12px;
  flex-shrink: 0;
}

.staff-sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #1d6fff 0%, #3b82f6 100%);
  box-shadow: 0 4px 14px rgba(29, 111, 255, 0.35);
  flex-shrink: 0;
}

.staff-sidebar-brand-text h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.staff-sidebar-tagline {
  margin: 2px 0 0;
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.02em;
}

.staff-online-card.hidden {
  display: none !important;
}

.staff-online-card {
  margin: 0 12px 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.staff-online-card__label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.staff-online-switch {
  flex-shrink: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
}

.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid #d8e5ff;
  background: linear-gradient(180deg, #fafbff 0%, #f4f7fc 100%);
}

.staff-logout-bar {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #64748b;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}
.staff-logout-bar:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.12);
}
.staff-logout-bar:active {
  transform: scale(0.99);
}
.staff-logout-bar__icon {
  flex-shrink: 0;
  color: currentColor;
}

.user-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: visible;
  max-height: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.user-list::-webkit-scrollbar {
  display: none;
}

.user-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #e6efff;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.staff-session-list .user-item,
.staff-workorder-list .user-item {
  margin: 6px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  border-bottom: 1px solid transparent;
}

.staff-session-list .user-item:hover,
.staff-workorder-list .user-item:hover {
  background: #fff;
  border-color: #dbeafe;
  box-shadow: 0 2px 8px rgba(29, 111, 255, 0.08);
  transform: none;
}

.staff-session-list .user-item.active {
  background: #fff;
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(29, 111, 255, 0.12);
  font-weight: 600;
}

.staff-workorder-list .user-item.active {
  background: #fff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.user-item:hover {
  background: #e8f0ff;
  transform: translateX(2px);
}

.user-item.active {
  background: #dce8ff;
  font-weight: 600;
  transform: none;
}
.user-item.active:hover {
  transform: none;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
  background: #f5f8ff;
}

.staff-messages.messages {
  max-height: none;
  flex: 1;
  min-height: 0;
  padding-bottom: 188px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.quick-reply-panel.staff-quick-panel {
  margin: 0;
  background: #fff;
  border: none;
  border-left: 1px solid #e2e8f0;
  border-radius: 0;
  padding: 12px 10px;
  height: 100%;
  overflow: hidden;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.6);
}

.staff-quick-head {
  margin: 0 4px 10px;
}

.staff-quick-head__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.staff-quick-head__text strong {
  font-size: 14px;
  color: #0f172a;
}

.staff-quick-head__hint {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
}

.quick-reply-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.staff-quick-panel .quick-reply-list {
  max-height: calc(100vh - 320px);
}

.quick-reply-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.quick-reply-list::-webkit-scrollbar {
  display: none;
}
.qr-group {
  border-radius: 10px;
  padding: 6px;
  background: #f8fbff;
  content-visibility: auto;
  contain-intrinsic-size: 200px 300px;
}
.qr-group.collapsed .qr-group-wrap {
  display: none;
}
.qr-group-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 2px 2px;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}
.qr-group-title-row:hover {
  background: rgba(29, 111, 255, 0.07);
}
.qr-group-title-row:focus-visible {
  outline: 2px solid #1d6fff;
  outline-offset: 1px;
}
.qr-group-chevron {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-top: -2px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.qr-group.collapsed .qr-group-chevron {
  transform: rotate(-45deg);
  margin-top: 0;
}
.qr-group-title-text {
  font-size: 12px;
  font-weight: 600;
  color: #3c5aa8;
  flex: 1;
  min-width: 0;
}
.qr-group-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qr-item {
  display: flex;
  gap: 2px;
  align-items: center;
}
.quick-send-btn {
  flex: 1;
  border: 1px solid #bcd2ff;
  border-radius: 10px;
  /* background: linear-gradient(180deg, #f7faff 0%, #edf4ff 100%); */
  color: #1f3f82;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.ui-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.18s ease;
}
.ui-modal-mask.closing {
  animation: fadeOut 0.16s ease forwards;
}
.ui-modal {
  width: min(92vw, 420px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(29, 111, 255, 0.2);
  padding: 16px;
  animation: popIn 0.2s ease;
}
.ui-modal-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.ui-modal-message {
  color: #334155;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ui-modal-input {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #bfd3ff;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}
.ui-modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.ui-modal-subrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
}

.ui-modal--rule {
  width: min(92vw, 440px);
}

.ui-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.ui-modal-field__label {
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
}

.ui-modal-field .ui-modal-input {
  margin-top: 0;
}
.ui-counter.bad {
  color: #b91c1c;
  font-weight: 700;
}
.ui-btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  background: #1d6fff;
  color: #fff;
  cursor: pointer;
}
.ui-btn-ghost {
  background: #e5edff;
  color: #1d4ed8;
}

.login-card {
  max-width: 340px;
  margin: 80px auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(29, 111, 255, 0.12);
  display: grid;
  gap: 10px;
}

.login-card h2 {
  margin: 0 0 8px;
}

.login-card input {
  padding: 10px;
  border: 1px solid #bfd3ff;
  border-radius: 8px;
}

.staff-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 20%, rgba(99, 102, 241, 0.12), transparent 50%),
    linear-gradient(165deg, #eef4ff 0%, #f8fafc 45%, #e8f0ff 100%);
}

.staff-login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 48px;
  box-sizing: border-box;
}

.staff-login-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 26px 26px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(29, 111, 255, 0.14);
  box-shadow:
    0 24px 48px rgba(29, 111, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.85) inset;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.staff-login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.staff-login-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #3b82f6 0%, #1d6fff 55%, #1e40af 100%);
  box-shadow: 0 8px 20px rgba(29, 111, 255, 0.35);
  flex-shrink: 0;
}

.staff-login-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.staff-login-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
}

.staff-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.staff-login-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.02em;
}

.staff-login-label-hint {
  font-weight: 500;
  color: #94a3b8;
}

.staff-login-card input[type="text"],
.staff-login-card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid rgba(91, 140, 255, 0.28);
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  background: rgba(248, 250, 252, 0.9);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.staff-login-card input[type="text"]:focus,
.staff-login-card input[type="password"]:focus {
  border-color: rgba(29, 111, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(29, 111, 255, 0.12);
}

.staff-captcha-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.staff-captcha-img-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #f1f5f9;
  line-height: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.staff-captcha-img-wrap:hover {
  border-color: rgba(29, 111, 255, 0.45);
  box-shadow: 0 4px 12px rgba(29, 111, 255, 0.15);
}
.staff-captcha-img-wrap:active {
  transform: scale(0.98);
}
.staff-captcha-img-wrap:focus {
  outline: none;
}
.staff-captcha-img-wrap:focus-visible {
  outline: 2px solid #1d6fff;
  outline-offset: 2px;
}

.staff-captcha-img {
  display: block;
  vertical-align: top;
  pointer-events: none;
  user-select: none;
}

.staff-captcha-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  box-sizing: border-box;
  padding: 12px 12px;
  border: 1px solid rgba(91, 140, 255, 0.28);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-indent: 0.08em;
  font-variant-numeric: tabular-nums;
  outline: none;
  background: rgba(248, 250, 252, 0.95);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.staff-captcha-input:focus {
  border-color: rgba(29, 111, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(29, 111, 255, 0.12);
}

@media (max-width: 420px) {
  .staff-captcha-line {
    flex-wrap: wrap;
  }
  .staff-captcha-img-wrap {
    margin-left: auto;
  }
  .staff-captcha-input {
    width: 100%;
    flex: 1 1 100%;
  }
}

.staff-login-submit {
  margin-top: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #1d6fff 100%);
  box-shadow: 0 4px 16px rgba(29, 111, 255, 0.35);
  transition: filter 0.15s ease, transform 0.1s ease;
}
.staff-login-submit:hover {
  filter: brightness(1.05);
}
.staff-login-submit:active {
  transform: scale(0.99);
}

.hint {
  margin: 0;
  font-size: 13px;
  color: #e23b3b;
}

.role-info {
  margin: 0 12px 12px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  flex-shrink: 0;
}

.staff-chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.staff-chat-header__main {
  min-width: 0;
  flex: 1;
}

.staff-chat-header__eyebrow {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.staff-chat-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-end-order-btn {
  flex-shrink: 0;
  position: static;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

.staff-btn-ghost {
  border: 1px solid #c7d9ff;
  border-radius: 8px;
  padding: 6px 12px;
  background: #fff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.staff-btn-ghost:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.staff-admin-entry {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 11px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #1d4ed8;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.staff-admin-entry.hidden {
  display: none !important;
}

.staff-admin-entry:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.staff-admin-entry:active {
  transform: scale(0.99);
}

.staff-admin-modal {
  --staff-admin-gap: 20px;
  --staff-admin-panel-height: min(86vh, calc(100vh - 2 * var(--staff-admin-gap)));
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--staff-admin-gap);
  box-sizing: border-box;
}

@supports (height: 100dvh) {
  .staff-admin-modal {
    --staff-admin-panel-height: min(86dvh, calc(100dvh - 2 * var(--staff-admin-gap)));
  }
}

.staff-admin-modal[hidden] {
  display: none !important;
}

.staff-admin-modal__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.staff-admin-modal__panel {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  height: var(--staff-admin-panel-height);
  max-height: var(--staff-admin-panel-height);
  min-height: min(360px, var(--staff-admin-panel-height));
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.staff-admin-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.staff-admin-modal__head-main {
  flex: 1;
  min-width: 0;
}

.staff-admin-modal__head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.staff-admin-modal__sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.staff-admin-modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  color: #64748b;
  background: #f1f5f9;
  cursor: pointer;
}

.staff-admin-modal__close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.staff-admin-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.staff-admin-nav {
  flex-shrink: 0;
  width: 112px;
  padding: 10px 8px;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.staff-admin-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 10px 6px;
  border: 0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.staff-admin-nav__item:hover {
  background: #e2e8f0;
  color: #334155;
}

.staff-admin-nav__item.is-active {
  color: #1d4ed8;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.staff-admin-nav__icon {
  font-size: 18px;
  line-height: 1;
}

.staff-admin-nav__label {
  line-height: 1.2;
}

.staff-admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f1f5f9;
}

.staff-admin-main__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.staff-admin-main__titles h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.staff-admin-main__titles p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.staff-admin-main__action {
  flex-shrink: 0;
  white-space: nowrap;
}

.staff-admin-main__action.hidden {
  display: none !important;
}

.staff-admin-modal__body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 14px;
}

.staff-admin-tab-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.staff-admin-tab-panel.hidden {
  display: none !important;
}

.staff-admin-dashboard {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.staff-admin-stats-section__title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.staff-admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 600px) {
  .staff-admin-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.staff-admin-stat-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #cbd5e1;
}

.staff-admin-stat-card--blue {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.staff-admin-stat-card--green {
  border-left-color: #22c55e;
  background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
}

.staff-admin-stat-card--amber {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #f8fafc 100%);
}

.staff-admin-stat-card--violet {
  border-left-color: #8b5cf6;
  background: linear-gradient(135deg, #f5f3ff 0%, #f8fafc 100%);
}

.staff-admin-stat-card strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.staff-admin-stat-card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
}

.staff-admin-platform-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staff-admin-platform-chip {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.staff-admin-platform-chip__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #dbeafe 0%, #eff6ff 100%);
  opacity: 0.85;
  pointer-events: none;
  border-radius: 10px 0 0 10px;
  min-width: 4px;
}

.staff-admin-platform-chip__name,
.staff-admin-platform-chip__count {
  position: relative;
  z-index: 1;
}

.staff-admin-platform-chip__name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.staff-admin-platform-chip__count {
  font-size: 13px;
  font-weight: 700;
  color: #1d4ed8;
  font-variant-numeric: tabular-nums;
}

.staff-admin-empty {
  margin: 0;
  padding: 20px 12px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}

.staff-admin-empty--error {
  color: #b91c1c;
}

.staff-admin-dashboard-foot {
  margin: 4px 0 0;
  padding-top: 12px;
  font-size: 11px;
  color: var(--admin-muted);
  line-height: 1.5;
  border-top: 1px solid var(--admin-line);
}

.staff-admin-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 20px 12px;
  min-height: 100%;
  box-sizing: border-box;
}

.staff-admin-page--rules {
  gap: 12px;
  padding-top: 12px;
}

.staff-admin-page__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

.staff-admin-block {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.staff-admin-block__head {
  padding: 14px 16px 0;
}

.staff-admin-block__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.staff-admin-block__head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
}

.staff-admin-block__desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--admin-muted);
  line-height: 1.45;
}

.staff-admin-block__body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.staff-admin-block__body--flush {
  padding-top: 8px;
}

.staff-admin-block__foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--admin-line);
}

.staff-admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.staff-admin-field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.staff-admin-field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
}

.staff-admin-field__hint {
  margin: 0;
  font-size: 12px;
  color: var(--admin-muted);
}

.staff-admin-field__sub {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text, #1a2b4b);
}

.staff-admin-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.staff-admin-check--inline {
  font-size: 12px;
  color: #64748b;
}

.staff-admin-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin: 0;
}

.staff-admin-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.staff-admin-switch__track {
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.2s;
}

.staff-admin-switch__dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.staff-admin-switch input:checked + .staff-admin-switch__track {
  background: #3b82f6;
}

.staff-admin-switch input:checked + .staff-admin-switch__track .staff-admin-switch__dot {
  transform: translateX(18px);
}

.staff-admin-switch__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.staff-admin-switch__text strong {
  font-size: 14px;
  color: #0f172a;
}

.staff-admin-switch__text small {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
}

.staff-admin-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 72px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.staff-admin-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.staff-admin-kw-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--admin-line, #e4e4e7);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.staff-admin-kw-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--admin-muted, #71717a);
  background: var(--admin-fill, #fafafa);
}

.staff-admin-kw-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--admin-line, #e4e4e7);
  background: #fff;
}

.staff-admin-kw-row:last-child {
  border-bottom: 0;
}

.staff-admin-kw-row__text {
  flex: 1;
  min-width: 0;
}

.staff-admin-kw-row__keyword {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text, #18181b);
  line-height: 1.35;
  word-break: break-word;
}

.staff-admin-kw-row__reply {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--admin-muted, #71717a);
  line-height: 1.45;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.staff-admin-kw-row__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.staff-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--admin-line, #e4e4e7);
  border-radius: 8px;
  background: #fff;
  color: var(--admin-muted, #71717a);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.staff-icon-btn:hover {
  color: var(--admin-text, #18181b);
  border-color: #a1a1aa;
  background: var(--admin-fill, #fafafa);
}

.staff-icon-btn--danger:hover {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.staff-admin-search-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 14px 16px 16px;
}

.staff-admin-search-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.staff-admin-search-bar input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  background: #f8fafc;
}

.staff-admin-search-bar input:focus {
  outline: none;
  border-color: #93c5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.staff-admin-search-status {
  margin: 10px 0 0;
  font-size: 12px;
  color: #64748b;
  flex-shrink: 0;
}

.staff-admin-search-results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

.staff-admin-search-hit {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #fafbff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.staff-admin-search-hit:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.staff-admin-search-hit__meta {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 6px;
  line-height: 1.4;
}

.staff-admin-search-hit__snippet {
  font-size: 13px;
  color: #0f172a;
  line-height: 1.5;
}

.staff-admin-search-hit__tag {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: #dbeafe;
  color: #1d4ed8;
}

.staff-admin-search-hit__tag.is-archived {
  background: #f1f5f9;
  color: #475569;
}

.staff-btn-primary {
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #1d6fff 100%);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29, 111, 255, 0.28);
}

.staff-btn-primary:hover {
  filter: brightness(1.05);
}

.staff-admin-account-list {
  list-style: none;
  margin: 0;
  padding: 12px 14px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staff-admin-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fafbff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.staff-admin-account-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}


.staff-admin-account-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.staff-admin-account-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.staff-admin-account-name {
  font-size: 15px;
  color: #0f172a;
}

.staff-admin-account-meta {
  font-size: 12px;
  color: #64748b;
}

.staff-admin-account-badge {
  grid-column: 2;
  grid-row: 1;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}

.staff-admin-account-badge.is-on {
  color: #166534;
  background: #dcfce7;
}

.staff-admin-account-badge.is-off {
  color: #b91c1c;
  background: #fee2e2;
}

.staff-admin-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.staff-admin-account-btn {
  font-size: 12px;
  padding: 5px 10px;
}

.staff-admin-account-hint {
  font-size: 12px;
  color: #94a3b8;
}

.staff-admin-account-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}

.admin-panel {
  max-width: 1100px;
  margin: 12px auto 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.admin-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.sidebar-section {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: #1a2b4b;
}
.sidebar-title-row:hover {
  background: rgba(29, 111, 255, 0.06);
}
.sidebar-title-row:focus-visible {
  outline: 2px solid #1d6fff;
  outline-offset: 1px;
}
.sidebar-title-row .sidebar-title {
  margin: 0;
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
.sidebar-chevron {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.sidebar-section.collapsed .sidebar-chevron {
  transform: rotate(-45deg);
}
.sidebar-section.collapsed .user-list {
  display: none;
}
.switch-btn {
  border: 0;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
}
.switch-track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  position: relative;
  transition: background 0.2s ease;
}
.switch-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
}
.switch-btn.on .switch-track {
  background: #22c55e;
  border-color: #16a34a;
}
.switch-btn.on .switch-dot {
  transform: translateX(20px);
}
.switch-btn.on {
  color: #166534;
}
.admin-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(29, 111, 255, 0.1);
  padding: 14px;
}
.admin-card h2 {
  margin: 0 0 8px;
}
.user-item-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.user-item-sub {
  font-size: 11px;
  color: #557;
  margin-top: 4px;
}
#workOrderList .user-item,
#workOrderList .user-item:hover,
#workOrderList .user-item.active,
#workOrderList .user-item.active:hover {
  transform: none;
}
#workOrderList .user-item {
  transition: background-color 0.2s ease;
}
#workOrderList .user-item.active {
  font-weight: 400;
}
#userList .user-item,
#userList .user-item:hover,
#userList .user-item.active,
#userList .user-item.active:hover {
  transform: none;
}
#userList .user-item {
  transition: background-color 0.2s ease;
}
#userList .user-item.active {
  font-weight: 600;
}
.qr-drag-handle {
  flex-shrink: 0;
  width: 22px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.qr-drag-handle:active {
  cursor: grabbing;
}
.red-dot {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  line-height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  text-align: center;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes popIn {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 768px) {
  .staff-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .staff-main {
    height: auto;
    min-height: calc(100vh - 280px);
  }

  .sidebar,
  .staff-sidebar.sidebar {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    max-height: none;
    overflow: visible;
    box-shadow: none;
  }
  .sidebar-body {
    flex: 0 1 auto;
    overflow: visible;
  }
  .staff-admin-modal {
    --staff-admin-gap: 0px;
    --staff-admin-panel-height: min(92vh, 100vh);
    padding: 0;
    align-items: flex-end;
  }

  @supports (height: 100dvh) {
    .staff-admin-modal {
      --staff-admin-panel-height: min(92dvh, 100dvh);
    }
  }

  .staff-admin-modal__panel {
    width: 100%;
    height: var(--staff-admin-panel-height);
    max-height: var(--staff-admin-panel-height);
    min-height: min(50vh, var(--staff-admin-panel-height));
    border-radius: 16px 16px 0 0;
  }
  .staff-admin-shell {
    flex-direction: column;
  }
  .staff-admin-nav {
    width: 100%;
    flex-direction: row;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
  }
  .staff-admin-nav__item {
    flex: 1;
    min-width: 72px;
    flex-direction: row;
    justify-content: center;
    padding: 8px 10px;
  }
  .staff-admin-nav__icon {
    font-size: 16px;
  }
  .staff-admin-main__head {
    flex-direction: column;
    align-items: stretch;
  }
  .staff-admin-main__action {
    width: 100%;
  }
  .staff-admin-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .staff-admin-page {
    padding: 12px 14px 10px;
  }
  .staff-admin-nav__item {
    font-size: 12px;
    padding: 8px 10px;
  }
  .admin-panel {
    grid-template-columns: 1fr;
    margin: 12px;
  }
  .chat-main {
    grid-template-columns: 1fr;
    height: auto;
  }
  .quick-reply-panel.staff-quick-panel {
    border-left: none;
    border-top: 1px solid #e2e8f0;
    margin: 0;
  }

  .input-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .chat-input-bar {
    bottom: calc(20px + env(safe-area-inset-bottom));
    margin: 0 8px 8px;
  }
}
