:root {
  --bg: #ededed;
  --panel: #f7f7f7;
  --wechat-green: #95ec69;
  --bubble-left: #ffffff;
  --text: #1f1f1f;
  --muted: #8a8a8a;
  --line: #e4e4e4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100%;
}

.chat-page {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.phone-statusbar {
  height: 28px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  background: #f2f2f2;
  color: #2a2a2a;
}

.chat-header {
  min-height: 52px;
  background: #f2f2f2;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px 12px;
}

.header-name {
  font-size: 16px;
  font-weight: 600;
  color: #000;
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-company {
  margin-top: 2px;
  font-size: 12px;
  color: #888;
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
}

.msg-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.msg-item.self {
  justify-content: flex-end;
}

.msg-item.other {
  justify-content: flex-start;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
}

.msg-bubble {
  max-width: 70%;
  width: auto;
  display: inline-block;
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.4;
  font-size: 15px;
  word-break: break-all;
  position: relative;
}

.msg-item.self .msg-bubble {
  background: var(--wechat-green);
}

.msg-item.other .msg-bubble {
  background: var(--bubble-left);
}

.msg-item.self .msg-bubble::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 13px;
  width: 10px;
  height: 10px;
  background: var(--wechat-green);
  transform: rotate(45deg);
}

.msg-item.other .msg-bubble::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 13px;
  width: 10px;
  height: 10px;
  background: var(--bubble-left);
  transform: rotate(45deg);
}

.msg-image-bubble {
  padding: 4px;
  background: transparent !important;
}

.msg-image-bubble::after {
  display: none;
}

.msg-image {
  display: block;
  width: min(220px, 60vw);
  max-height: 280px;
  border-radius: 8px;
  object-fit: cover;
}

.msg-time-divider {
  text-align: center;
  color: #969696;
  font-size: 12px;
  margin: 8px 0 12px;
}

.chat-input-wrap {
  padding: 8px 10px;
  border-top: 1px solid #dbdbdb;
  background: #f7f7f7;
  display: flex;
  gap: 8px;
  align-items: center;
}

.wechat-input-bar {
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.input-wrapper {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.chat-input {
  width: 100%;
  height: 38px;
  border: 0;
  background: #fff;
  border-radius: 6px;
  padding: 0 40px 0 10px;
  font-size: 16px;
  outline: none;
}

.inner-mic {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.chat-file-input {
  display: none;
}

.status-tip {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 0;
}

.agent-layout {
  height: 100vh;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #f5f5f5;
}

.session-pane {
  width: 260px;
  border-right: 1px solid var(--line);
  background: #efefef;
}

.session-title {
  padding: 16px 14px;
  font-weight: 600;
}

.session-item {
  padding: 12px 10px;
  background: #e6e6e6;
  display: flex;
  gap: 10px;
}

.session-item.active {
  background: #dadada;
}

.session-avatar {
  width: 44px;
  height: 44px;
  border-radius: 4px;
}

.session-main-meta {
  flex: 1;
  min-width: 0;
}

.session-line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 4px;
}

.session-line time {
  color: #858585;
  font-size: 12px;
}

.session-preview {
  font-size: 12px;
  color: #828282;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-mask.show {
  display: flex;
}

.agent-card {
  width: min(86vw, 320px);
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.agent-card-head {
  display: flex;
  gap: 12px;
  padding: 16px;
}

.agent-card-head img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}

.agent-card-meta h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.agent-card-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.agent-card-body {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 13px;
}

.agent-home-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #ededed;
}

.agent-home-card {
  width: min(92vw, 360px);
  background: #fff;
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.agent-home-avatar {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
}

.agent-home-name {
  margin: 12px 0 4px;
  font-size: 22px;
}

.agent-home-title {
  margin: 0 0 8px;
  font-size: 14px;
  color: #666;
}

.agent-home-company,
.agent-home-verified {
  margin: 4px 0;
  font-size: 13px;
  color: #848484;
}

.agent-home-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.agent-home-btn {
  flex: 1;
  text-decoration: none;
  height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.agent-home-btn.primary {
  background: #07c160;
  color: #fff;
}

.agent-home-btn.secondary {
  border: 1px solid #d9d9d9;
  color: #222;
  background: #fff;
}

@media (max-width: 760px) {
  .agent-layout {
    display: block;
    max-width: 430px;
  }

  .session-pane {
    display: none;
  }

  .session-main {
    height: 100vh;
  }
}
