/* a4zbabz · 站内消息（inbox）
 *
 * 与 chat.css 完全独立：这里只有「会话 + 消息气泡」，没有房间 / 成员 / 媒体。
 * 布局：左列会话，右列对话。窄屏（<=860px）自动叠成上下：会话列表在上，
 * 选中会话后隐藏列表、只显示对话（data-view="thread"）。
 */

.page-inbox main { padding-top: 24px; }

.inbox-app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 190px);
  margin-bottom: 40px;
}

/* ---------------- 左：会话列表 ---------------- */
.inbox-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--line, rgb(0 0 0 / 0.08));
  border-radius: 16px;
  overflow: hidden;
}

.inbox-side-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line, rgb(0 0 0 / 0.08));
}

.inbox-side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
}

.inbox-side-title .spacer { margin-left: auto; }

.inbox-side-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.inbox-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
}

.inbox-item:hover { background: var(--bg-card-hover); }

.inbox-item.is-on {
  background: var(--accent-soft);
  border-color: var(--accent-ring, rgb(124 58 237 / 0.22));
}

.inbox-item-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

.inbox-item-body { min-width: 0; flex: 1; }

.inbox-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.inbox-item-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-badge {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: #ef4444;
}

/* ---------------- 右：会话 ---------------- */
.inbox-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--line, rgb(0 0 0 / 0.08));
  border-radius: 16px;
  overflow: hidden;
}

.inbox-main-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, rgb(0 0 0 / 0.08));
}

.inbox-main-title { font-size: 15px; font-weight: 650; }
.inbox-main-sub { margin-top: 2px; font-size: 12px; color: var(--muted, #6b7280); }

.inbox-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-msg {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-sunk);
}

.inbox-msg.is-mine {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.inbox-msg:not(.is-mine) { border-bottom-left-radius: 6px; }

.inbox-msg-meta {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.65;
}

.inbox-compose {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line, rgb(0 0 0 / 0.08));
}

.inbox-compose textarea {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid var(--line, rgb(0 0 0 / 0.12));
  background: var(--bg-input);
  color: inherit;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  max-height: 160px;
}

.inbox-compose textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring, rgb(124 58 237 / 0.22));
}

.inbox-gate {
  padding: 24px;
  text-align: center;
  color: var(--muted, #6b7280);
}

.inbox-gate p { margin: 0 0 12px; }

.inbox-empty {
  margin: 12px;
  font-size: 13px;
  color: var(--muted, #6b7280);
  text-align: center;
}

/* 超管「新通知」：收件人选择 */
.inbox-picker {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(12 14 18 / 0.5);
}

.inbox-picker.hidden { display: none; }

.inbox-picker-card {
  width: min(420px, 100%);
  max-height: min(560px, 84vh);
  display: flex;
  flex-direction: column;
  background: var(--bg-modal);
  border: 1px solid var(--line, rgb(0 0 0 / 0.1));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgb(0 0 0 / 0.35);
}

.inbox-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 650;
  border-bottom: 1px solid var(--line, rgb(0 0 0 / 0.08));
}

.inbox-picker-head button {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.inbox-picker-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.inbox-picker-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--line, rgb(0 0 0 / 0.08));
}

.inbox-picker-item small {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted, #6b7280);
}

/* ---------------- 窄屏 ---------------- */
@media (max-width: 860px) {
  .inbox-app { grid-template-columns: 1fr; min-height: calc(100vh - 150px); }
  .inbox-app[data-view="list"] .inbox-main { display: none; }
  .inbox-app[data-view="thread"] .inbox-side { display: none; }
  .inbox-msg { max-width: 88%; }
}
