/* Inbox (v1.18): notification list + two-pane private chat. */

.inbox-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px clamp(16px, 2.4vw, 28px) 64px;
}

.inbox-gate {
  max-width: 520px;
  margin: 12vh auto 0;
}

/* ---------- header ---------- */

.inbox-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--hero-bg);
  box-shadow:
    inset 0 1px 0 rgb(var(--tint-rgb) / 0.07),
    0 40px 80px -60px var(--shadow-strong);
}

.inbox-kicker {
  margin: 0 0 6px;
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.inbox-hero h1 {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -0.02em;
}

.inbox-hero-text > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.inbox-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--seg-bg);
}

.inbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}

.inbox-tab:hover {
  color: var(--text);
}

.inbox-tab.on {
  color: var(--seg-text);
  background: var(--side-on-bg);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / 0.32);
}

.inbox-tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgb(var(--danger-rgb) / 0.18);
  color: var(--danger-text);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.inbox-tab-count[hidden] {
  display: none;
}

/* ---------- panel / toolbar ---------- */

.inbox-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  box-shadow: inset 0 1px 0 rgb(var(--tint-rgb) / 0.05);
}

.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.inbox-filter {
  display: flex;
  gap: 6px;
}

.inbox-filter-btn {
  height: 30px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease);
}

.inbox-filter-btn:hover {
  color: var(--text);
  background: rgb(var(--tint-rgb) / 0.05);
}

.inbox-filter-btn.on {
  color: var(--accent-text-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.inbox-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- notifications ---------- */

.inbox-list {
  display: flex;
  flex-direction: column;
}

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.inbox-item:last-child {
  border-bottom: 0;
}

.inbox-item:hover {
  background: rgb(var(--tint-rgb) / 0.035);
}

.inbox-item.is-unread {
  background: linear-gradient(90deg, rgb(var(--accent-rgb) / 0.075), transparent 55%);
}

.inbox-item.is-unread:hover {
  background: linear-gradient(90deg, rgb(var(--accent-rgb) / 0.11), rgb(var(--tint-rgb) / 0.02) 60%);
}

.inbox-ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(var(--tint-rgb) / 0.04);
  color: var(--icon-muted);
}

.inbox-ico svg {
  width: 18px;
  height: 18px;
}

.inbox-item[data-kind="moderation"] .inbox-ico {
  color: var(--warn-text);
  border-color: rgb(var(--warn-rgb) / 0.28);
  background: rgb(var(--warn-rgb) / 0.09);
}

.inbox-item[data-kind="comment"] .inbox-ico {
  color: var(--link-soft);
  border-color: rgb(var(--accent-rgb) / 0.28);
  background: rgb(var(--accent-rgb) / 0.09);
}

.inbox-item[data-kind="follow"] .inbox-ico {
  color: var(--ok-text);
  border-color: rgb(var(--ok-rgb) / 0.18);
  background: rgb(var(--ok-rgb) / 0.08);
}

.inbox-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.inbox-item-title {
  color: var(--text);
  font-size: 13.8px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.inbox-item-detail {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.inbox-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--faint);
  font-size: 11.5px;
}

.inbox-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.15);
}

.inbox-item:not(.is-unread) .inbox-dot {
  visibility: hidden;
}

.inbox-more {
  display: flex;
  justify-content: center;
  padding: 14px;
}

.inbox-more .ui-btn[hidden] {
  display: none;
}

.inbox-panel .ui-msg {
  margin: 0;
  padding: 0 18px 12px;
}

/* ---------- chat ---------- */

.inbox-chat {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  height: min(640px, calc(100vh - 230px));
  min-height: 460px;
}

.inbox-threads {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.inbox-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 13px;
}

.inbox-threads > #threadList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.inbox-thread-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.inbox-thread-item:hover {
  background: rgb(var(--tint-rgb) / 0.04);
}

.inbox-thread-item.on {
  background: linear-gradient(90deg, rgb(var(--accent-rgb) / 0.14), rgb(var(--accent2-rgb) / 0.05));
  box-shadow: inset 2px 0 0 var(--accent);
}

.inbox-thread-main {
  flex: 1 1 auto;
  min-width: 0;
}

.inbox-thread-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.inbox-thread-name time {
  flex-shrink: 0;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 500;
}

.inbox-thread-last {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-thread-unread {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.inbox-threads .ui-empty {
  margin: 18px;
  padding: 22px 16px;
}

.inbox-threads .ui-msg {
  padding: 0 16px 12px;
}

.inbox-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.inbox-thread-placeholder {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 24px;
  color: var(--muted);
  text-align: center;
}

.inbox-thread-placeholder b {
  color: var(--text-soft);
  font-size: 14.5px;
}

.inbox-thread-placeholder p {
  margin: 0;
  font-size: 12.5px;
}

.inbox-thread-placeholder-ico {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(var(--tint-rgb) / 0.04);
  color: var(--icon-muted);
}

.inbox-thread-placeholder-ico svg {
  width: 26px;
  height: 26px;
}

.inbox-thread-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.inbox-thread-top {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.inbox-thread-id {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.inbox-thread-id b {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-thread-id a {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-thread-id a:hover {
  color: var(--link-hover);
}

.inbox-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-older {
  flex-shrink: 0;
  align-self: center;
  margin: 10px auto 0;
}

.inbox-older[hidden] {
  display: none;
}

.inbox-bubble {
  align-self: flex-start;
  max-width: min(78%, 560px);
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  background: rgb(var(--tint-rgb) / 0.055);
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.inbox-bubble.mine {
  align-self: flex-end;
  border-color: rgb(var(--accent-rgb) / 0.32);
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, rgb(var(--accent-rgb) / 0.24), rgb(var(--accent2-rgb) / 0.16));
  color: var(--text);
}

.inbox-bubble time {
  display: block;
  margin-top: 5px;
  color: var(--faint);
  font-size: 10.5px;
  text-align: right;
}

.inbox-thread-empty {
  align-self: center;
  margin: auto;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.inbox-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  background: rgb(var(--bg-soft) / 0.55);
}

.inbox-composer textarea {
  width: 100%;
  min-height: 74px;
  max-height: 180px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  box-sizing: border-box;
}

.inbox-composer textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.12);
}

.inbox-composer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inbox-count {
  flex-shrink: 0;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.inbox-composer-row .ui-msg {
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  font-size: 12px;
}

.inbox-composer-row .ui-btn {
  flex-shrink: 0;
}

/* ---------- new-message dialog ---------- */

.inbox-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 4px 0 2px;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.inbox-field .ui-input {
  height: 40px;
}

.inbox-dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

#newMsgDlg .ui-msg {
  margin: 10px 0 0;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .inbox-chat {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .inbox-threads {
    max-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .inbox-thread {
    min-height: 460px;
  }

  .inbox-hero {
    align-items: flex-start;
  }

  .inbox-tabs {
    width: 100%;
    justify-content: center;
  }

  .inbox-tab {
    flex: 1 1 0;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .inbox-shell {
    padding: 14px 12px 48px;
  }

  .inbox-hero {
    padding: 20px 18px 18px;
  }

  .inbox-toolbar {
    align-items: stretch;
  }

  .inbox-toolbar-actions {
    justify-content: space-between;
  }

  .inbox-item {
    padding: 14px 14px;
    gap: 11px;
  }

  .inbox-bubble {
    max-width: 88%;
  }
}
