/* ══════════════════════════════════════════════════════════════════════════
   CHAT HUB (spec 016 §7). Two panes on desktop; on the mobile shell one
   full-screen column (channel list, then a pushed view). #chat-hub must be
   display:none when closed — mobile-shell.js watchOverlays() reads it.
   ══════════════════════════════════════════════════════════════════════════ */

.chat-backdrop {
  display: none; position: fixed; inset: 0; z-index: 4100;
  background: rgba(8,5,2,.62); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.chat-backdrop.open { display: flex; animation: fadeIn .2s ease; }

.chat-card {
  position: relative; display: grid; grid-template-columns: 220px 1fr;
  width: 860px; max-width: 96vw; height: 78vh; max-height: 720px; overflow: hidden;
  background: linear-gradient(160deg, #1c1610 0%, #110e09 100%);
  border: 1px solid rgba(200,148,26,.3); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  color: #f2e6c9; font-family: 'Crimson Pro', Georgia, serif;
}
.chat-close {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  background: none; border: none; cursor: pointer; font-size: 18px; color: rgba(244,201,93,.6);
}
.chat-close:hover { color: #f4c95d; }

/* Left: channel list */
.chat-side { border-right: 1px solid rgba(200,148,26,.15); padding: 16px 12px; overflow-y: auto; background: rgba(0,0,0,.18); }
.chat-side-title { font-family: 'Playfair Display', serif; font-size: 20px; color: #f4c95d; margin: 0 4px 14px; }
.chat-sec { margin-bottom: 18px; }
.chat-sec-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #EF9F27; margin: 0 4px 6px; }
.chat-soon { font-size: 13px; font-style: italic; color: rgba(242,230,201,.45); margin: 0 4px; }
.chat-clan-name { font-weight: 600; margin: 0 4px 6px; color: #f2e6c9; }
.chat-tab {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%;
  padding: 9px 10px; min-height: 40px; margin-bottom: 4px; border-radius: 8px; cursor: pointer;
  background: none; border: 1px solid transparent; color: rgba(242,230,201,.85); font: inherit; font-size: 15px; text-align: left;
}
.chat-tab:hover { background: rgba(244,201,93,.06); }
.chat-tab.on { background: rgba(244,201,93,.12); border-color: rgba(244,201,93,.3); color: #f4c95d; }
.chat-tab.locked { color: rgba(242,230,201,.5); }
.chat-lock { font-size: 12px; color: rgba(242,230,201,.55); }
.chat-dot { width: 8px; height: 8px; border-radius: 50%; background: #d8642f; }

/* Right: main view */
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-head {
  display: flex; align-items: center; gap: 8px; min-height: 52px;
  padding: 10px 48px 10px 16px; border-bottom: 1px solid rgba(200,148,26,.15);
}
.chat-head-title { flex: 1; min-width: 0; font-family: 'Playfair Display', serif; font-size: 17px; color: #e8d0a0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back { background: none; border: none; color: #f4c95d; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 6px 2px 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; -webkit-overflow-scrolling: touch; }
.chat-empty { padding: 28px 16px; text-align: center; font-style: italic; color: rgba(242,230,201,.55); list-style: none; }
.chat-muted { color: rgba(242,230,201,.55); }
.small { font-size: 12.5px; }

.chat-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 15px; font-weight: 500;
  background: linear-gradient(180deg, #c8941a, #9a6d12); color: #1c1812; border: 1px solid rgba(244,201,93,.5);
}
.chat-btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.chat-btn.ghost { background: transparent; color: #f2e6c9; border-color: rgba(242,230,201,.25); }
.chat-btn.danger { background: transparent; color: #e98a6b; border-color: rgba(233,138,107,.45); }
.chat-btn.block { display: flex; width: 100%; margin-top: 8px; }
.chat-link { background: none; border: none; cursor: pointer; color: rgba(244,201,93,.8); font: inherit; font-size: 12.5px; padding: 2px 4px; }
.chat-link.danger { color: #e98a6b; }

/* Locked */
.chat-locked { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.chat-locked-ic { font-size: 40px; }
.chat-locked-title { font-family: 'Playfair Display', serif; font-size: 19px; color: #f4c95d; }
.chat-bar { width: min(320px, 80%); height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.chat-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #BA7517, #f4c95d); }

/* Forum */
.chat-threads { list-style: none; margin: 0; padding: 0; }
.chat-thread {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; cursor: pointer;
  padding: 11px 8px; min-height: 52px; background: none; border: none; border-bottom: 1px solid rgba(200,148,26,.1);
  color: inherit; font: inherit;
}
.chat-thread:hover { background: rgba(244,201,93,.05); }
.chat-thread-title { font-size: 16px; color: #f2e6c9; overflow-wrap: anywhere; }
.chat-post { padding: 10px 0 12px; border-bottom: 1px solid rgba(200,148,26,.1); }
.chat-post.first .chat-post-body { font-size: 16px; }
.chat-post-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.chat-post-meta b { color: #f4c95d; font-weight: 600; }
.chat-post-actions { margin-left: auto; }
.chat-post-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.chat-compose { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; overflow-y: auto; }
.chat-form-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#chat-hub input, #chat-hub textarea {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 8px;
  background: rgba(0,0,0,.35); color: #f2e6c9; border: 1px solid rgba(242,230,201,.2);
  font: inherit; font-size: 16px; resize: vertical;
}
.chat-compose textarea { flex: 1; min-height: 160px; }

/* Composer (reply + live chat) */
.chat-composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px;
  border-top: 1px solid rgba(200,148,26,.15); background: rgba(0,0,0,.2);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.chat-composer textarea { min-height: 42px; max-height: 160px; }

/* Live chat */
.chat-msgs { list-style: none; margin: 0; padding: 0; }
.chat-msg { padding: 5px 8px; margin: 2px 0; border-radius: 8px; position: relative; }
.chat-msg:hover { background: rgba(255,255,255,.03); }
.chat-msg.mine { background: rgba(244,201,93,.07); }
.chat-msg-meta b { color: #f4c95d; font-weight: 600; margin-right: 4px; }
.chat-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.system { text-align: center; font-size: 13px; font-style: italic; color: rgba(192,221,151,.75); padding: 4px 0; }
.chat-msg-del { float: right; opacity: 0; }
.chat-msg:hover .chat-msg-del, .chat-msg:focus-within .chat-msg-del { opacity: 1; }
body.kw-shell .chat-msg-del { opacity: .7; }
.chat-new-chip {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 2;
  padding: 6px 14px; border-radius: 16px; border: 1px solid rgba(244,201,93,.5); cursor: pointer;
  background: #2c2014; color: #f4c95d; font: inherit; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.chat-new-chip[hidden] { display: none; }

/* ── Narrow / mobile shell: one column, pushed views ── */
@media (max-width: 759px) {
  .chat-card { grid-template-columns: 1fr; }
  .chat-backdrop.chat-pushed .chat-side { display: none; }
  .chat-backdrop:not(.chat-pushed) .chat-main { display: none; }
}
body.kw-shell #chat-hub { align-items: stretch; justify-content: stretch; backdrop-filter: none; }
body.kw-shell #chat-hub .chat-card {
  grid-template-columns: 1fr; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none;
  border-radius: 0; border: none; padding-top: env(safe-area-inset-top, 0px);
}
body.kw-shell #chat-hub.chat-pushed .chat-side { display: none; }
body.kw-shell #chat-hub:not(.chat-pushed) .chat-main { display: none; }
body.kw-shell #chat-hub .chat-side { padding-top: 18px; }

/* Realm channels */
.chat-about { padding: 8px 16px; font-size: 13.5px; font-style: italic; color: rgba(242,230,201,.6); border-bottom: 1px solid rgba(200,148,26,.1); }
.chat-clan-tag {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 5px; padding: 0 6px; height: 17px;
  border-radius: 4px; font-size: 11px; font-weight: 600; font-style: normal; vertical-align: 1px;
  color: #fffaf0; background: var(--c, #5b646c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
  max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* ── Moderation ── */
.chat-staff-badge {
  display: inline-flex; align-items: center; margin-left: 5px; padding: 0 5px; height: 16px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-style: normal; vertical-align: 1px;
  color: #10231a; background: #7fc8a0;
}
.chat-staff-badge.admin { color: #2a1605; background: #f4c95d; }
.chat-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #d8642f; color: #fff; font-size: 11px; font-weight: 700;
}
.chat-report { opacity: 0; margin-left: 4px; color: rgba(242,230,201,.55); }
.chat-report:hover { color: #e98a6b; }
.chat-msg:hover .chat-report, .chat-msg:focus-within .chat-report,
.chat-post:hover .chat-report, .chat-post:focus-within .chat-report { opacity: 1; }
body.kw-shell .chat-report { opacity: .6; }
.chat-msg-meta .chat-report { float: right; }
.chat-muted-note { justify-content: center; text-align: center; font-style: italic; }

/* Report sheet (over the open view) */
.chat-sheet-back {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  background: rgba(8,5,2,.6); padding: 16px;
}
.chat-sheet {
  width: min(420px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 18px; border-radius: 12px; background: #1c1610; border: 1px solid rgba(200,148,26,.35);
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.chat-sheet-title { font-family: 'Playfair Display', serif; font-size: 17px; color: #f4c95d; }
.chat-reasons { display: flex; flex-direction: column; gap: 2px; }
.chat-reason { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px; border-radius: 6px; cursor: pointer; }
.chat-reason:hover { background: rgba(244,201,93,.06); }
#chat-hub .chat-reason input { width: auto; accent-color: #c8941a; }
.mod-snap {
  margin: 0; padding: 8px 10px; border-left: 3px solid rgba(233,138,107,.6); border-radius: 0 6px 6px 0;
  background: rgba(0,0,0,.25); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; max-height: 180px; overflow-y: auto;
}

/* Queue, mutes, log, moderators */
.mod-toggle { display: flex; gap: 6px; }
.mod-card { padding: 12px 0 14px; border-bottom: 1px solid rgba(200,148,26,.12); display: flex; flex-direction: column; gap: 8px; }
.mod-card.resolved { opacity: .85; }
.mod-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mod-card-head .chat-count { margin-left: auto; }
.mod-pill { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: rgba(233,138,107,.15); color: #e98a6b; }
.mod-reports { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mod-reason { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: rgba(242,230,201,.1); margin-right: 6px; }
.mod-reason.abuse { background: rgba(216,100,47,.25); color: #f4a67f; }
.mod-reason.spam { background: rgba(200,148,26,.2); color: #f4c95d; }
.mod-reason.inappropriate { background: rgba(170,110,200,.2); color: #d6b1ea; }
.mod-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mod-mute { display: inline-flex; gap: 6px; align-items: center; }
.mod-outcome.actioned { color: #e98a6b; }
.mod-outcome.dismissed { color: #9fcf9f; }
.mod-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
#chat-hub .mod-form input { flex: 1 1 160px; width: auto; }
.chat-select {
  min-height: 34px; padding: 4px 8px; border-radius: 8px; font: inherit; font-size: 14px;
  background: rgba(0,0,0,.35); color: #f2e6c9; border: 1px solid rgba(242,230,201,.2);
}
.mod-help { margin-bottom: 10px; }
.mod-list { list-style: none; margin: 0; padding: 0; }
.mod-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(200,148,26,.1); }
.mod-snip { font-style: italic; overflow-wrap: anywhere; }
button.chat-clan-tag { border: none; cursor: pointer; font-family: inherit; }
button.chat-clan-tag:hover { filter: brightness(1.15); }
