/* ==========================================================
   QALITY TRANSCRIPTS — premium dark, brand red #ff0042
   ========================================================== */

:root {
  --bg: #07070a;
  --bg-1: #0a0a0e;
  --bg-2: #0f0f14;
  --surface: #131319;
  --surface-2: #1a1a22;
  --surface-3: #22222c;
  --surface-4: #2d2d39;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --dim: rgba(255, 255, 255, 0.44);
  --faint: rgba(255, 255, 255, 0.28);
  --red: #ff0042;
  --red-2: #ff3366;
  --red-soft: rgba(255, 0, 66, 0.14);
  --red-glow: rgba(255, 0, 66, 0.45);
  --green: #2ed47a;
  --blue: #5094ff;
  --yellow: #ffc42e;
  --orange: #ff8030;
  --purple: #b061ff;
  --discord: #5865f2;
  --container: min(100% - 48px, 1280px);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow-sm: 0 4px 12px -4px rgba(0, 0, 0, 0.4);
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 32px 80px -16px rgba(0, 0, 0, 0.7);
  --shadow-red: 0 12px 40px -12px var(--red-glow);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 0, 66, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(255, 51, 102, 0.06), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--blue); }
a.link:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; }
p { margin: 0; }
.muted { color: var(--muted); }
.accent { color: var(--red); }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 14px;
}
.kicker::before {
  content: '';
  width: 18px; height: 1px;
  background: var(--red);
}

/* Scrollbar */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; }
.scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

/* ============== Header ============== */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 7, 10, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 18px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 900; letter-spacing: 0.08em; font-size: 15px;
}
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.20em;
  color: var(--muted);
  text-transform: uppercase;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  font-weight: 600;
}
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 14px 5px 5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.18s ease;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip img { width: 30px; height: 30px; border-radius: 50%; }
.user-chip b { font-size: 13.5px; }
.uchip-staff {
  background: var(--red-soft);
  color: var(--red);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,0,66,0.35);
}
.logout-link {
  font-size: 12px; color: var(--muted);
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: all 0.18s ease;
  font-weight: 600;
}
.logout-link:hover { color: #fff; border-color: var(--border-strong); background: rgba(255,255,255,0.03); }

/* ============== Buttons ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: 11px;
  font-size: 14px; font-weight: 700;
  font-family: var(--font);
  transition: all 0.18s ease;
  white-space: nowrap;
  color: #fff;
}
.btn-primary {
  background: var(--red);
  box-shadow: var(--shadow-red), 0 0 0 1px rgba(255, 0, 66, 0.4) inset;
}
.btn-primary:hover { background: var(--red-2); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.22); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 9px; }
.btn-discord {
  display: inline-flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 28px;
  background: var(--discord);
  border-radius: 12px;
  color: #fff;
  font-size: 14.5px; font-weight: 700;
  text-decoration: none;
  transition: all 0.18s ease;
  box-shadow: 0 12px 40px -10px rgba(88, 101, 242, 0.55);
}
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); }

/* ============== Page ============== */
.page {
  max-width: var(--container);
  margin: 0 auto;
  padding: 56px 24px 80px;
}

/* ============== Hero (list) ============== */
.hero {
  position: relative;
  text-align: center;
  margin-bottom: 48px;
  padding: 12px 0 28px;
}
.hero-grid {
  position: absolute;
  inset: -40px -40px auto -40px;
  height: 220px;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero-title {
  position: relative;
  font-family: var(--display);
  font-size: clamp(40px, 5.5vw, 68px);
  line-height: 1.0;
  letter-spacing: -0.05em;
  margin-bottom: 16px;
  font-weight: 700;
}
.hero-title .accent {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 28px var(--red-glow));
}
.hero-desc {
  position: relative;
  color: var(--muted);
  font-size: 16.5px;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.55;
}
.hero-stats {
  position: relative;
  display: inline-flex;
  margin-top: 28px;
  padding: 14px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  gap: 28px;
  box-shadow: var(--shadow);
}
.hero-stat {
  display: flex; flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.hero-stat-value {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1;
}
.hero-stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}
.hero-stat + .hero-stat {
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

/* ============== Loading ============== */
.loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 40vh;
  grid-column: 1 / -1;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============== Login card ============== */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}
.login-card {
  text-align: center;
  padding: 56px 48px;
  background:
    radial-gradient(ellipse at top, rgba(255,0,66,0.04) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s ease both;
}
.login-discord-icon {
  width: 80px; height: 80px;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.28);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px;
  box-shadow: 0 12px 32px -12px rgba(88, 101, 242, 0.5);
}
.login-card h2 {
  font-family: var(--display);
  font-size: 28px;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}
.login-card p {
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
  font-size: 15px;
}

/* ============== Toolbar ============== */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.search {
  flex: 1; min-width: 220px;
  position: relative;
}
.search input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px 11px 42px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  outline: 0;
  transition: all 0.18s ease;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,0,66,0.12); }
.search > span {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
  display: flex;
}
.scope-pills {
  display: inline-flex; padding: 3px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 2px;
}
.scope-pill {
  height: 34px; padding: 0 16px;
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px; font-weight: 600;
  transition: all 0.18s ease;
}
.scope-pill:hover { color: #fff; }
.scope-pill.active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 12px -4px var(--red-glow);
}

/* ============== Transcript list ============== */
.tr-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
.tr-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
  background:
    radial-gradient(ellipse at top, rgba(255,0,66,0.04), transparent 70%),
    var(--surface);
  border: 1px dashed var(--border);
  border-radius: 18px;
  grid-column: 1 / -1;
}
.tr-empty-icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--dim);
}
.tr-empty h3 { font-size: 19px; color: #fff; margin-bottom: 6px; font-family: var(--display); letter-spacing: -0.02em; }
.tr-empty p  { font-size: 14px; max-width: 360px; margin: 0 auto; }

.tr-card {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px 22px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.22s cubic-bezier(0.32, 0.72, 0.24, 1);
  overflow: hidden;
  isolation: isolate;
  animation: fadeUp 0.4s ease both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.tr-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 200px at 100% 0%, rgba(255,0,66,0.10), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: -1;
}
.tr-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.tr-card:hover {
  border-color: rgba(255, 0, 66, 0.35);
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -20px rgba(255, 0, 66, 0.25), var(--shadow);
}
.tr-card:hover::before { opacity: 1; }
.tr-card:hover::after  { opacity: 1; }
.tr-card-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.tr-card-head .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
.tr-card-head .pill-mini {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--faint);
}
.tr-card h3 {
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #fff;
  word-break: break-word;
}
.tr-card-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tr-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.tr-card-meta b { color: #fff; font-weight: 600; }
.tr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}
.tr-chip-source-web     { background: rgba(88,101,242,0.14);  color: #8b97ff; }
.tr-chip-source-discord { background: rgba(46,212,122,0.14);  color: var(--green); }
.tr-chip-priority-low     { background: rgba(80,148,255,0.14); color: var(--blue); }
.tr-chip-priority-medium  { background: rgba(255,196,46,0.14); color: var(--yellow); }
.tr-chip-priority-high    { background: rgba(255,128,48,0.14); color: var(--orange); }
.tr-chip-priority-urgent  { background: rgba(255,0,66,0.18);   color: var(--red); }
.tr-chip-neutral          { background: rgba(255,255,255,0.06); color: var(--muted); }
.tr-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.tr-card-foot .id {
  font-family: var(--mono);
  color: var(--faint);
  letter-spacing: 0.08em;
}
.tr-card-foot .open {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; color: var(--muted);
  font-size: 12px;
  transition: color 0.18s ease;
}
.tr-card:hover .open { color: var(--red); }

/* ============== Viewer page ============== */
.viewer-page {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.viewer-crumb {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}
.viewer-crumb a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted);
  transition: color 0.18s ease;
}
.viewer-crumb a:hover { color: #fff; }
.viewer-crumb .sep { color: var(--faint); }

.viewer-head {
  position: relative;
  display: flex; gap: 18px;
  padding: 24px;
  background:
    radial-gradient(circle 400px at 100% 0%, rgba(255,0,66,0.06), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.4s ease both;
}
.viewer-head-icon {
  width: 56px; height: 56px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--red);
}
.viewer-info { flex: 1; min-width: 0; }
.viewer-info h1 {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  word-break: break-word;
  color: #fff;
  line-height: 1.2;
}
.viewer-info .meta {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.viewer-info .meta b { color: #fff; font-weight: 600; }
.viewer-info .badges {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.viewer-actions { display: flex; gap: 8px; flex-shrink: 0; align-self: flex-start; }

.viewer-thread-wrap {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.012) 0%, transparent 100px),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 60vh;
  max-height: calc(100vh - 240px);
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.4s ease both;
  animation-delay: 60ms;
}
.viewer-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 32px;
}
.viewer-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 18px;
}

/* ============== Discord-style messages ============== */
.msg {
  display: flex;
  gap: 16px;
  padding: 6px 8px;
  margin: 0 -8px;
  position: relative;
  border-radius: 8px;
  transition: background-color 0.12s ease;
}
.msg:hover { background: rgba(255, 255, 255, 0.018); }
.msg + .msg.merged { padding-top: 1px; padding-bottom: 1px; margin-top: -2px; }
.msg:not(.merged) { padding-top: 12px; margin-top: 4px; }
.msg-avatar-col {
  width: 42px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}
.msg-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
  box-shadow: 0 4px 12px -4px rgba(0,0,0,0.4);
}
.msg.merged .msg-avatar { display: none; }
.msg-side-time {
  display: none;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
  text-align: center;
  width: 100%;
}
.msg.merged:hover .msg-side-time { display: block; }
.msg-body { flex: 1; min-width: 0; }
.msg-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 2px;
}
.msg-author {
  font-size: 15.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.005em;
}
.msg-bot {
  background: var(--red-soft);
  color: var(--red);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  vertical-align: 2px;
  box-shadow: inset 0 0 0 1px rgba(255,0,66,0.3);
}
.msg-time {
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.msg-content {
  font-size: 14.5px;
  line-height: 1.5;
  color: rgba(255,255,255,0.94);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg-content strong { color: #fff; font-weight: 700; }
.msg-content em { font-style: italic; }
.msg-content del { color: var(--muted); }
.msg-content code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: #fff;
}
.msg-content pre {
  margin: 8px 0;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.msg-content pre code {
  background: none;
  padding: 0;
  border: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255,255,255,0.88);
}
.msg-content blockquote {
  margin: 4px 0;
  padding: 2px 14px;
  border-left: 3px solid var(--border-strong);
  color: rgba(255,255,255,0.78);
}
.msg-content .subtext {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.msg-content a { color: var(--blue); }
.msg-content a:hover { text-decoration: underline; }
.msg-content .mention {
  display: inline-block;
  background: rgba(80,148,255,0.18);
  color: #b6cdff;
  padding: 0 5px;
  border-radius: 4px;
  font-weight: 500;
}
.msg-content .mention-role {
  background: rgba(255,0,66,0.18);
  color: #ff8aa8;
}
.msg-content .mention-channel {
  background: rgba(46,212,122,0.18);
  color: #8feab7;
}
.msg-content .emoji {
  display: inline-block;
  width: 1.4em; height: 1.4em;
  vertical-align: -0.3em;
  object-fit: contain;
}
.msg-content .emoji-jumbo { width: 2.8em; height: 2.8em; }
.msg-content .spoiler {
  background: var(--surface-3);
  color: var(--surface-3);
  border-radius: 4px;
  padding: 0 2px;
  cursor: pointer;
  transition: color 0.18s ease;
}
.msg-content .spoiler:hover { color: #fff; background: var(--surface-2); }
.msg-content .disc-time,
.embed .disc-time {
  display: inline-block;
  background: var(--surface-3);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  font-weight: 500;
  cursor: help;
}
.msg-content .h-1, .embed .h-1 { font-size: 19px; font-weight: 700; margin: 6px 0 2px; line-height: 1.25; color: #fff; }
.msg-content .h-2, .embed .h-2 { font-size: 17px; font-weight: 700; margin: 5px 0 2px; line-height: 1.25; color: #fff; }
.msg-content .h-3, .embed .h-3 { font-size: 15px; font-weight: 700; margin: 4px 0 2px; line-height: 1.25; color: #fff; }
.embed .disc-time { font-size: 12.5px; }

.msg-edited {
  font-size: 10.5px;
  color: var(--faint);
  margin-left: 4px;
}

/* ── Reply preview ──────────────────────────────────────────── */
.msg-reply {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding-left: 22px;
  margin-bottom: 4px;
  margin-top: 2px;
  position: relative;
}
.msg-reply::before {
  content: '';
  position: absolute;
  left: 8px; top: 14px;
  width: 14px; height: 10px;
  border-top: 2px solid var(--border-strong);
  border-left: 2px solid var(--border-strong);
  border-top-left-radius: 8px;
}
.msg-reply img { width: 18px; height: 18px; border-radius: 50%; }
.msg-reply b { color: rgba(255,255,255,0.82); font-weight: 600; }
.msg-reply-text {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60ch;
}

/* ── Attachments ────────────────────────────────────────────── */
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.att-image {
  position: relative;
  display: block;
  max-width: 440px;
  max-height: 340px;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid var(--border);
  background: var(--bg-1);
  transition: transform 0.18s ease;
}
.att-image:hover { transform: scale(1.005); }
.att-image img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  width: auto; height: auto;
}
.att-video {
  max-width: 480px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.att-video video { display: block; width: 100%; max-height: 360px; }
.att-audio {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 280px;
}
.att-audio audio { flex: 1; }
.att-file {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 260px;
  max-width: 440px;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
}
.att-file:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.att-file-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-1);
  border-radius: 10px;
  color: var(--red);
  flex-shrink: 0;
}
.att-file-meta { flex: 1; min-width: 0; }
.att-file-name {
  display: block;
  font-size: 14px; font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-file-size { display: block; font-size: 11.5px; color: var(--dim); margin-top: 2px; }

/* ── Stickers ───────────────────────────────────────────────── */
.msg-stickers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg-stickers img {
  width: 160px; height: 160px;
  border-radius: 12px;
  background: var(--bg-1);
}

/* ── Embeds ─────────────────────────────────────────────────── */
.embed {
  display: grid;
  grid-template-columns: auto 1fr;
  max-width: 540px;
  margin-top: 8px;
  background: var(--bg-1);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.embed-stripe {
  width: 4px;
  background: var(--red);
}
.embed-body {
  padding: 14px 18px 16px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.embed-author {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.94);
}
.embed-author img { width: 24px; height: 24px; border-radius: 50%; }
.embed-title {
  font-size: 15px; font-weight: 700;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
  letter-spacing: -0.01em;
}
.embed-title a { color: var(--blue); }
.embed-desc {
  font-size: 13.5px; color: rgba(255,255,255,0.86);
  line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
}
.embed-fields {
  display: grid;
  gap: 10px 16px;
  margin-top: 4px;
}
.embed-fields.inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.embed-field-name { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.embed-field-value { font-size: 13px; color: rgba(255,255,255,0.86); white-space: pre-wrap; word-wrap: break-word; }
.embed-image {
  margin-top: 4px;
  max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
}
.embed-image img { display: block; max-width: 100%; max-height: 340px; cursor: zoom-in; }
.embed-thumb {
  margin-left: 14px;
  flex-shrink: 0;
}
.embed-thumb img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: 6px;
}
.embed-footer {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--muted);
  margin-top: 6px;
}
.embed-footer img { width: 18px; height: 18px; border-radius: 50%; }

/* ── Components (buttons / selects) ──────────────────────────── */
.msg-components { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.comp-row { display: flex; flex-wrap: wrap; gap: 8px; }
.comp-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 4px;
  background: var(--surface-3);
  color: #fff;
  font-size: 13.5px; font-weight: 600;
  cursor: default;
  display: inline-flex; align-items: center; gap: 6px;
  pointer-events: none;
  text-decoration: none;
}
.comp-btn-1 { background: #4e5d94; }       /* primary  */
.comp-btn-2 { background: var(--surface-3); }
.comp-btn-3 { background: #248046; }       /* success  */
.comp-btn-4 { background: #a12828; }       /* danger   */
.comp-btn-5 { background: var(--surface-3); border: 1px solid var(--border); pointer-events: auto; cursor: pointer; }
.comp-btn-5::after { content: '↗'; opacity: 0.7; margin-left: 2px; }
.comp-select {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 9px 14px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.72);
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 220px;
  pointer-events: none;
}
.comp-select::after {
  content: '▾';
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.comp-text {
  background: var(--surface-2);
  border-left: 2px solid var(--border-strong);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.86);
  white-space: pre-wrap;
}

/* ── Reactions ──────────────────────────────────────────────── */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.reaction {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: rgba(255,255,255,0.88);
}
.reaction img { width: 16px; height: 16px; }
.reaction b { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

/* ── System messages ─────────────────────────────────────────── */
.msg-system {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 64px;
  font-size: 13px;
  color: var(--muted);
  position: relative;
}
.msg-system::before {
  content: '';
  position: absolute;
  left: 26px; top: 50%;
  width: 18px; height: 14px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  border-bottom-left-radius: 4px;
  transform: translateY(-50%);
}
.msg-system b { color: rgba(255,255,255,0.92); font-weight: 600; }

/* ── Date divider ────────────────────────────────────────────── */
.date-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 20px 0 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}
.date-divider::before,
.date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.date-divider span {
  padding: 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}

/* ── Lightbox ────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 40px;
  cursor: zoom-out;
  animation: fadeUp 0.2s ease both;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  cursor: default;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
}
.lightbox-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 20px;
}
.lightbox-close:hover { background: rgba(255,255,255,0.16); }

/* ============== Footer ============== */
.footer {
  text-align: center;
  padding: 28px;
  color: var(--dim);
  font-size: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 80px;
}

/* ============== Responsive ============== */
@media (max-width: 760px) {
  .page { padding: 32px 16px 60px; }
  .hero-stats { flex-direction: column; gap: 14px; padding: 16px 20px; }
  .hero-stat + .hero-stat { padding-left: 0; border-left: 0; padding-top: 14px; border-top: 1px solid var(--border); }
  .tr-list { grid-template-columns: 1fr; }
  .viewer-page { padding: 16px 12px; }
  .viewer-head { flex-direction: column; padding: 18px; }
  .viewer-head-icon { width: 44px; height: 44px; }
  .viewer-actions { width: 100%; }
  .viewer-thread { padding: 14px 14px 20px; }
  .msg-avatar-col { width: 36px; }
  .msg-avatar { width: 36px; height: 36px; }
  .top-inner { gap: 12px; padding: 12px 16px; }
  .brand-tag { display: none; }
  .embed { max-width: 100%; }
  .att-image { max-width: 100%; }
}
