/* inbox-v1 — self-contained per prototype principle. */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ============ APP SHELL ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 680px) 320px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ============ SIDEBAR ============ */
.sidebar { position: sticky; top: 24px; height: calc(100vh - 48px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 800; margin-bottom: 36px; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
  padding: 14px 18px; color: var(--text-soft); border-radius: 999px; font-weight: 600; font-size: 16px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sidebar nav a.active, .sidebar nav a:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
.user-pill {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, transform 0.05s;
}
.user-pill:hover { border-color: var(--primary); transform: translateY(-1px); }
.user-pill:active { transform: translateY(0); }
.up-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--primary), var(--ai));
  flex-shrink: 0; overflow: hidden;
}
.up-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-info { min-width: 0; flex: 1; }
.up-info b {
  display: block; font-size: 13px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.up-info small {
  display: block; font-size: 11px; color: var(--text-soft); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.new-post { border-radius: 999px; background: var(--cta-bg); color: var(--cta-text); font-weight: 700; padding: 14px 22px; font-size: 16px; }

/* ============ MAIN ============ */
.main { min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; min-height: 44px;
}
.topbar h1 { font-size: 28px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.topbar-brand img { width: 24px; height: 24px; object-fit: contain; }

/* topbar actions cluster (chip + buttons) */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.wallet-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.wallet-chip:hover { background: var(--surface); border-color: var(--primary); transform: translateY(-1px); }
.wallet-chip .ic { display: inline-flex; align-items: center; line-height: 1; }
.wallet-chip .ic svg { display: block; }

.onair-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800; font-size: 13px;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.onair-btn:hover { background: var(--error); border-color: var(--error); color: white; }
.onair-btn .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  animation: onair-pulse 1.6s ease-in-out infinite;
}
.onair-btn:hover .dot { background: white; box-shadow: 0 0 0 0 rgba(255,255,255,0.55); }
@keyframes onair-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }

/* ============ INBOX LIST ============ */
.inbox-card { padding: 0; overflow: hidden; }
.inbox-list { list-style: none; padding: 0; margin: 0; }
.inbox-list li { margin: 0; }
.inbox-list a {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.inbox-list li:last-child a { border-bottom: 0; }
.inbox-list a:hover { background: var(--surface-soft); }

.inbox-list .meta { flex: 1; min-width: 0; }
.inbox-list .top-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.inbox-list .name {
  font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-list .name .paid-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}
.inbox-list .time { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

.inbox-list .preview-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 2px;
}
.inbox-list .preview {
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.inbox-list .unread {
  background: var(--primary);
  color: white;
  font-weight: 800; font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* unread state — slightly bolder preview */
.inbox-list a.unread-state .preview { color: var(--text); font-weight: 600; }
.inbox-list a.unread-state .time { color: var(--primary); font-weight: 700; }

/* ============ AVATAR ============ */
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 800; flex-shrink: 0; user-select: none; font-size: 16px; }
.avatar.g1 { background: linear-gradient(135deg, var(--primary), var(--ai)); }
.avatar.g2 { background: linear-gradient(135deg, var(--ai), var(--info)); }
.avatar.g3 { background: linear-gradient(135deg, var(--success), var(--ai)); }
.avatar.g4 { background: linear-gradient(135deg, var(--accent), var(--accent-warm)); }
.avatar.g5 { background: linear-gradient(135deg, var(--primary), var(--accent)); }

/* ============ RIGHT PANEL ============ */
.right-panel { display: flex; flex-direction: column; gap: 18px; }
.right-panel .card { padding: 18px; }
.right-panel h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }

.pps-card .pps-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pps-card .pps-row:last-of-type { border-bottom: 0; }
.pps-card .pps-row .k { color: var(--text-soft); font-size: 13px; }
.pps-card .pps-row .v {
  font-weight: 800; font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.pps-card .pps-row .v small { font-size: 11px; opacity: 0.7; margin-left: 3px; }
.pps-card .pps-row .v.earned { color: var(--success); }
.pps-card .note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.55;
}

.settings-card h2 { display: flex; align-items: baseline; justify-content: space-between; }
.settings-card .qs-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
}
.settings-card .qs-link:hover { text-decoration: underline; }
.settings-card ul { list-style: none; padding: 0; margin: 0; }
.settings-card li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.settings-card li:last-child { border-bottom: 0; }
.settings-card .label { font-weight: 600; }
.settings-card .val { color: var(--text-soft); }

/* ============ BACK TO TOP ============ */
.to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 50;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.32);
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
}
.to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (hover: hover) {
  .to-top:hover { background: var(--primary-dark); }
}
.to-top:active { transform: translateY(0) scale(0.94); }
@media (max-width: 720px) {
  .to-top {
    bottom: 88px; right: 16px; width: 42px; height: 42px;
    transition: opacity 0.2s, transform 0.2s, background 0.15s,
                bottom 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.nav-hidden .to-top { bottom: 28px; }
}

/* ============ MOBILE NAV ============ */
.mobile-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    padding-bottom: 96px;
    gap: 12px;
  }
  .sidebar, .right-panel { display: none; }

  .topbar {
    position: sticky; top: 0; z-index: 10;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 4px; margin: 0 0 12px;
  }
  .topbar h1 { display: none; }
  .topbar-brand { display: inline-flex; }

  .mobile-nav {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 20;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  }
  .mobile-nav.nav-hidden {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav a { text-align: center; font-size: 12px; color: var(--text-soft); padding: 8px 4px; }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav .compose-btn {
    width: 46px; height: 46px;
    margin: auto; padding: 0;
    border-radius: 50%;
    background: var(--cta-bg); color: var(--cta-text);
    display: grid; place-items: center; line-height: 1;
  }
}

/* ============ PAY PER CHAT NOTICE MODAL（同 profile-v1 同一款） ============ */
.premium-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.premium-modal[hidden] { display: none !important; }
.pm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
}
.pm-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
  text-align: center;
  animation: pm-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pm-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.pm-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}
.pm-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.pm-intro {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}
.pm-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.pm-cancel,
.pm-primary {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  transition: opacity 0.15s, background 0.15s, transform 0.05s;
}
.pm-cancel {
  background: var(--surface-soft);
  color: var(--text-soft);
}
.pm-cancel:hover { background: var(--line); color: var(--text); }
.pm-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}
.pm-primary:hover { transform: translateY(-1px); }
