:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --surface: #161a23;
  --surface-2: #1c212c;
  --border: #262c39;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --accent: #10b981;
  --player: #3b82f6;
  --staff: #f59e0b;
  --bot: #a855f7;
  --participant: #14b8a6;
  --danger: #ef4444;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(16,185,129,.08), transparent 60%),
              radial-gradient(900px 500px at 110% 10%, rgba(59,130,246,.07), transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: #60a5fa; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- Botões ---------- */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 11px 16px; font: 600 14px var(--font);
       cursor: pointer; color: var(--text); background: var(--surface-2); transition: .15s ease; }
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: var(--accent); color: #04130d; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Cartões centrais (login / erro) ---------- */
.page-center { display: grid; place-items: center; padding: 24px 16px; }
.card { background: rgba(22,26,35,.85); border: 1px solid var(--border); border-radius: 20px;
        padding: 36px 32px; box-shadow: 0 30px 80px rgba(0,0,0,.45); backdrop-filter: blur(8px); }
.card-narrow { width: 100%; max-width: 420px; text-align: center; }
.card h1 { margin: 10px 0 6px; font-size: 22px; }
.card-icon { font-size: 34px; width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center;
             border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); }
.login-form { text-align: left; margin-top: 22px; display: grid; gap: 10px; }
.login-form label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap input { width: 100%; padding: 13px 46px 13px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font: 600 17px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.input-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0;
               color: var(--muted); cursor: pointer; font-size: 16px; padding: 6px 8px; }
.alert { margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: rgba(239,68,68,.12);
         border: 1px solid rgba(239,68,68,.35); color: #fecaca; font-size: 14px; }

/* ---------- Layout do transcript ---------- */
.layout { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
.topbar { position: sticky; top: 0; z-index: 10; margin: 0 -16px; padding: 0 16px;
          background: rgba(11,13,18,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1080px; margin: 0 auto; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.accent { color: var(--accent); }

.hero { display: flex; gap: 24px; justify-content: space-between; align-items: flex-end; flex-wrap: wrap;
        margin-top: 28px; padding: 26px; border-radius: var(--radius); border: 1px solid var(--border);
        background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)) 0%, var(--surface) 60%); }
.hero h1 { margin: 10px 0 6px; font-size: 30px; letter-spacing: -.02em; }
.hero-main { min-width: 0; flex: 1 1 380px; }
.hero-subject { margin: 0; color: #cfd3dc; max-height: 7.5em; overflow: auto; word-break: break-word; }
.hero-stats { display: flex; gap: 10px; }
.stat { background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; min-width: 96px; text-align: center; }
.stat-value { display: block; font-weight: 800; font-size: 18px; }
.stat-label { font-size: 12px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge-dept { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent);
              border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }

.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.info { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
        display: flex; flex-direction: column; min-width: 0; word-break: break-word; }
.info-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.person-name { font-weight: 600; }
.person-id { font: 12px var(--mono); color: var(--muted); }

.timeline { margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.timeline summary { cursor: pointer; font-weight: 600; }
.timeline ol { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 4px 0 8px 12px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 11px; width: 10px; height: 10px; border-radius: 50%;
                        background: var(--accent); border: 2px solid var(--bg); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
           margin: 22px 0 10px; position: sticky; top: 56px; z-index: 5; padding: 10px 0; background: var(--bg); }
.toolbar input { flex: 1 1 260px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
                 background: var(--surface); color: var(--text); font: 14px var(--font); }
.toolbar input:focus { outline: none; border-color: var(--accent); }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid; }
.chip-player { color: var(--player); border-color: color-mix(in srgb, var(--player) 45%, transparent); }
.chip-staff { color: var(--staff); border-color: color-mix(in srgb, var(--staff) 45%, transparent); }
.chip-participant { color: var(--participant); border-color: color-mix(in srgb, var(--participant) 45%, transparent); }
.chip-bot { color: var(--bot); border-color: color-mix(in srgb, var(--bot) 45%, transparent); }

/* ---------- Chat ---------- */
.chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0; }
.date-sep { display: flex; align-items: center; gap: 12px; margin: 14px 18px; color: var(--muted); font-size: 12px; font-weight: 700; }
.date-sep::before, .date-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.group { display: flex; gap: 14px; padding: 10px 18px; border-left: 3px solid transparent; }
.group:hover { background: rgba(255,255,255,.02); }
.group.role-player { border-left-color: var(--player); }
.group.role-staff { border-left-color: var(--staff); }
.group.role-bot { border-left-color: var(--bot); }
.group.role-participant { border-left-color: var(--participant); }
.role-participant .author { color: #5eead4; }
.role-participant .role-tag { background: rgba(20,184,166,.18); color: var(--participant); }
.info-wide { grid-column: 1 / -1; gap: 2px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--surface-2); object-fit: cover; }
.group-body { min-width: 0; flex: 1; }
.group-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.author { font-weight: 700; }
.role-player .author { color: #93c5fd; }
.role-staff .author { color: #fcd34d; }
.role-bot .author { color: #d8b4fe; }
.role-tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; }
.role-player .role-tag { background: rgba(59,130,246,.18); color: var(--player); }
.role-staff .role-tag { background: rgba(245,158,11,.18); color: var(--staff); }
.role-bot .role-tag { background: rgba(168,85,247,.18); color: var(--bot); }
.author-id { font: 11px var(--mono); color: var(--muted); }
.group-head time { font-size: 12px; color: var(--muted); margin-left: auto; }
.msg { position: relative; padding: 2px 0; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-time { position: absolute; left: -56px; top: 4px; width: 44px; text-align: right; font-size: 11px; color: var(--muted); opacity: 0; }
.msg:hover .msg-time { opacity: 1; }
.msg:target { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; }
.content { white-space: normal; }
.edited { font-size: 11px; color: var(--muted); }
.reply-ref { display: block; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 2px;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-ref:hover { color: var(--text); }
.is-system .content { color: var(--muted); font-style: italic; }

.mention { background: rgba(88,101,242,.22); color: #c9cdfb; border-radius: 4px; padding: 0 3px; font-weight: 500; }
.md-code { font: 13px var(--mono); background: var(--bg-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
.md-pre { font: 13px/1.5 var(--mono); background: var(--bg-2); border: 1px solid var(--border); padding: 10px 12px;
          border-radius: 8px; overflow-x: auto; margin: 6px 0; white-space: pre; }
.md-quote { margin: 4px 0; padding: 2px 0 2px 12px; border-left: 4px solid var(--border); }
.md-h1 { display: block; font-size: 20px; font-weight: 800; } .md-h2 { display: block; font-size: 17px; font-weight: 800; }
.md-h3 { display: block; font-size: 15px; font-weight: 800; } .md-sub { display: block; font-size: 12px; color: var(--muted); }
.md-emoji { width: 22px; height: 22px; vertical-align: -5px; }
.md-ts { background: rgba(255,255,255,.07); padding: 0 4px; border-radius: 4px; }
.spoiler { background: #202225; color: transparent; border-radius: 4px; cursor: pointer; transition: .2s; }
.spoiler.revealed, .spoiler:focus { color: inherit; background: rgba(255,255,255,.08); }

/* ---------- Embeds ---------- */
.embed { margin: 6px 0; max-width: 560px; background: var(--bg-2); border: 1px solid var(--border);
         border-left: 4px solid var(--embed-color, var(--border)); border-radius: 6px; padding: 10px 14px; }
.embed-author { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.embed-title { font-weight: 700; margin-bottom: 4px; }
.embed-desc { font-size: 14px; }
.embed-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.embed-field { flex: 1 1 100%; min-width: 0; font-size: 14px; }
.embed-field.inline { flex: 1 1 150px; }
.embed-field-name { font-weight: 700; font-size: 13px; }
.embed-img { display: block; max-width: 100%; max-height: 300px; border-radius: 6px; margin-top: 8px; }
.embed-footer { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- Anexos ---------- */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-image img { display: block; max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.att-media { max-width: min(460px, 100%); border-radius: 8px; }
.file-card, .file-link { display: inline-flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px;
             background: var(--bg-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; max-width: 100%; }
.file-card small { display: block; color: var(--muted); font-size: 12px; }
.file-card strong { word-break: break-all; }
.file-icon { font-size: 22px; }
.file-missing { border-style: dashed; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 100; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.page-footer { text-align: center; margin-top: 18px; }
.empty-search { text-align: center; padding: 24px; }

/* ---------- Responsivo ---------- */
@media (max-width: 820px) {
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 24px; }
  .hero-stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .info-grid { grid-template-columns: minmax(0, 1fr); }
  .group { padding: 10px 12px; gap: 10px; }
  .avatar { width: 32px; height: 32px; }
  .author-id { display: none; }
  .group-head time { margin-left: 0; width: 100%; }
  .msg-time { display: none; }
  .card { padding: 28px 20px; }
  .brand-sep, .brand-sep + span { display: none; }
}
