  /* ===== Variáveis (cores oficiais do Discord dark) ===== */
  :root{
    --bg-primary:#313338;
    --bg-secondary:#2b2d31;
    --bg-tertiary:#1e1f22;
    --bg-hover:#2e3035;
    --bg-embed:#2b2d31;
    --text-normal:#dbdee1;
    --text-strong:#f2f3f5;
    --text-muted:#949ba4;
    --brand:#5865f2;
    --green:#23a55a;
    --link:#00a8fc;
    --divider:#3f4147;
  }

  *{ box-sizing:border-box; }

  html,body{ height:100%; }

  body{
    margin:0;
    background:var(--bg-tertiary);
    font-family:"gg sans","Noto Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
    font-size:16px;
    line-height:1.375;
    color:var(--text-normal);
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
  }

  .app{
    max-width:900px;
    margin:0 auto;
    min-height:100vh;
    display:flex;
    flex-direction:column;
    background:var(--bg-primary);
    box-shadow:0 0 0 1px rgba(0,0,0,.35), 0 10px 40px rgba(0,0,0,.5);
  }

  /* ===== Topbar ===== */
  .topbar{
    position:sticky;
    top:0;
    z-index:20;
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 16px;
    background:var(--bg-primary);
    border-bottom:1px solid rgba(0,0,0,.3);
    box-shadow:0 1px 3px rgba(0,0,0,.35);
  }

  .hash-icon{
    flex:none;
    width:32px;
    height:32px;
    border-radius:50%;
    background:var(--bg-tertiary);
    color:var(--text-muted);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:17px;
    font-weight:600;
  }

  .topbar-text{ min-width:0; flex:1; }

  .topbar-text h1{
    margin:0;
    font-size:16px;
    font-weight:600;
    color:var(--text-strong);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .topbar-text p{
    margin:0;
    font-size:12px;
    color:var(--text-muted);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .status-pill{
    flex:none;
    font-size:11px;
    font-weight:600;
    text-transform:uppercase;
    letter-spacing:.4px;
    padding:4px 10px;
    border-radius:20px;
    color:#fff;
    background:#ed4245;
  }

  /* ===== Card de metadados ===== */
  .meta{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));
    gap:1px;
    background:rgba(0,0,0,.25);
    border-bottom:1px solid rgba(0,0,0,.3);
  }

  .meta-item{
    background:var(--bg-secondary);
    padding:10px 16px;
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width:0;
  }

  .meta-label{
    font-size:11px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.4px;
    color:var(--text-muted);
  }

  .meta-value{
    font-size:14px;
    font-weight:500;
    color:var(--text-strong);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  /* ===== Área do chat ===== */
  .chat{
    flex:1;
    padding:16px 0 40px;
  }

  .divider{
    display:flex;
    align-items:center;
    gap:8px;
    margin:16px 16px 8px;
    color:var(--text-muted);
    font-size:12px;
    font-weight:600;
  }

  .divider::before,
  .divider::after{
    content:"";
    flex:1;
    height:1px;
    background:var(--divider);
  }

  /* ===== Mensagens ===== */
  .message{
    position:relative;
    padding:2px 32px 2px 72px;
    margin-top:0;
  }

  .message:hover{ background:var(--bg-hover); }

  .message .avatar{
    position:absolute;
    left:16px;
    top:4px;
    width:40px;
    height:40px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:16px;
    font-weight:600;
    color:#fff;
    user-select:none;
    overflow:hidden;
  }

  .avatar.user{ background:linear-gradient(135deg,#5865f2,#a259ff); }
  .avatar.staff{ background:linear-gradient(135deg,#00b0f4,#0077b6); }
  .avatar.bot{ background:linear-gradient(135deg,#5865f2,#3b45c9); font-size:20px; }

  .message.grouped .avatar{ display:none; }

  .hover-time{
    position:absolute;
    left:16px;
    top:4px;
    width:40px;
    text-align:right;
    font-size:11px;
    line-height:22px;
    color:var(--text-muted);
    opacity:0;
    user-select:none;
    pointer-events:none;
  }

  .message.grouped:hover .hover-time{ opacity:1; }

  .msg-header{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:6px;
    line-height:22px;
  }

  .username{
    font-size:16px;
    font-weight:500;
    color:var(--text-strong);
  }

  .username.staff{ color:#00b0f4; }
  .username.bot{ color:#f2f3f5; }

  .bot-tag{
    display:inline-flex;
    align-items:center;
    height:15px;
    padding:0 4px;
    margin-left:2px;
    border-radius:3px;
    background:var(--brand);
    color:#fff;
    font-size:10px;
    font-weight:600;
    line-height:1;
    text-transform:uppercase;
    letter-spacing:.2px;
    vertical-align:middle;
  }

  .role-chip{
    display:inline-flex;
    align-items:center;
    gap:4px;
    height:20px;
    padding:0 6px;
    border-radius:4px;
    font-size:11px;
    font-weight:600;
    color:#00b0f4;
    background:rgba(0,176,244,.12);
    border:1px solid rgba(0,176,244,.35);
  }

  .msg-time{
    font-size:12px;
    font-weight:400;
    color:var(--text-muted);
    margin-left:2px;
  }

  .msg-content{
    font-size:16px;
    line-height:1.375;
    color:var(--text-normal);
    white-space:pre-wrap;
    overflow-wrap:break-word;
    word-break:break-word;
  }

  .msg-content .mention{
    background:rgba(88,101,242,.3);
    color:#c9cdfb;
    border-radius:3px;
    padding:0 2px;
    font-weight:500;
  }

  .msg-content strong{ font-weight:700; color:var(--text-strong); }
  .msg-content em{ font-style:italic; }
  .msg-content u{ text-decoration:underline; }
  .msg-content s{ text-decoration:line-through; }

  .msg-content code{
    background:#1e1f22;
    border:1px solid #111214;
    border-radius:4px;
    padding:1px 4px;
    font-family:Consolas,"Andale Mono",Monaco,monospace;
    font-size:14px;
    color:#dbdee1;
  }

  .msg-content a{ color:var(--link); text-decoration:none; }
  .msg-content a:hover{ text-decoration:underline; }

  /* Spoiler (||texto||) */
  .msg-content .spoiler{
    background:#1e1f22;
    color:transparent;
    border-radius:4px;
    padding:0 3px;
    cursor:pointer;
    transition:background .12s, color .12s;
    user-select:none;
  }
  .msg-content .spoiler.revealed{
    background:rgba(79,84,92,.4);
    color:inherit;
    user-select:text;
  }

  /* Bloco de código (```lang ... ```) */
  .msg-content .code-block{
    background:#1e1f22;
    border:1px solid #111214;
    border-radius:4px;
    margin:4px 0;
    overflow:hidden;
    max-width:100%;
  }
  .msg-content .code-lang{
    padding:4px 12px;
    font-size:11px;
    font-weight:600;
    color:#949ba4;
    background:#111214;
    border-bottom:1px solid #2b2d31;
    font-family:Consolas,monospace;
    text-transform:uppercase;
    letter-spacing:.5px;
  }
  .msg-content .code-block pre{
    margin:0;
    padding:8px 12px;
    overflow-x:auto;
    font-family:Consolas,"Andale Mono",Monaco,monospace;
    font-size:14px;
    line-height:1.4;
    color:#dbdee1;
    white-space:pre;
    word-break:normal;
  }
  .msg-content .code-block code{
    background:none;
    border:none;
    padding:0;
    font-size:inherit;
  }

  /* ===== Menção de resposta ===== */
  .reply{
    display:flex;
    align-items:center;
    gap:6px;
    margin-bottom:2px;
    font-size:14px;
    color:var(--text-muted);
    position:relative;
    padding-left:16px;
  }

  .reply::before{
    content:"";
    position:absolute;
    left:-40px;
    top:50%;
    width:52px;
    height:16px;
    border-left:2px solid var(--divider);
    border-top:2px solid var(--divider);
    border-top-left-radius:6px;
    transform:translateY(-6px);
  }

  .reply strong{ color:#c9cdfb; font-weight:500; }

  /* ===== Embeds ===== */
  .embed{
    display:grid;
    grid-template-columns:auto 1fr;
    gap:0 12px;
    margin-top:6px;
    padding:12px 16px 14px 12px;
    max-width:520px;
    background:var(--bg-embed);
    border-radius:4px;
    border-left:4px solid var(--brand);
    box-shadow:0 1px 2px rgba(0,0,0,.25);
  }

  .embed-inner{ grid-column:2; min-width:0; }

  .embed-title{
    font-size:16px;
    font-weight:600;
    color:var(--text-strong);
    margin-bottom:6px;
  }

  .embed-desc{
    font-size:14px;
    line-height:1.4;
    color:var(--text-normal);
    margin-bottom:8px;
  }

  .embed-fields{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(120px, 1fr));
    gap:8px 16px;
    margin-top:4px;
  }

  .embed-field .field-name{
    font-size:13px;
    font-weight:700;
    color:var(--text-strong);
    margin-bottom:1px;
  }

  .embed-field .field-value{
    font-size:14px;
    line-height:1.35;
    color:var(--text-normal);
    overflow-wrap:break-word;
  }

  .embed-footer{
    margin-top:10px;
    display:flex;
    align-items:center;
    gap:6px;
    font-size:12px;
    color:var(--text-muted);
  }

  .embed-footer .dot{
    width:4px;
    height:4px;
    border-radius:50%;
    background:var(--text-muted);
  }

  .tag-ok{
    display:inline-block;
    padding:0 6px;
    border-radius:4px;
    background:rgba(35,165,90,.15);
    color:#3ddc84;
    font-size:12px;
    font-weight:600;
  }

  /* ===== Anexo ===== */
  .attachment{
    margin-top:6px;
    max-width:320px;
    border-radius:8px;
    overflow:hidden;
    background:var(--bg-secondary);
    border:1px solid #1e1f22;
  }

  .attach-preview{
    height:150px;
    background:
      radial-gradient(circle at 25% 30%, rgba(88,101,242,.55), transparent 55%),
      radial-gradient(circle at 75% 70%, rgba(162,89,255,.5), transparent 55%),
      linear-gradient(135deg,#232428,#1b1c1f);
    display:flex;
    align-items:center;
    justify-content:center;
    color:rgba(255,255,255,.55);
    font-size:11px;
    font-weight:600;
    letter-spacing:1px;
    text-transform:uppercase;
    border-bottom:1px solid #1e1f22;
  }

  .attach-name{
    padding:8px 10px;
    font-size:13px;
    color:var(--link);
    display:flex;
    justify-content:space-between;
    gap:8px;
  }

  .attach-name span{ color:var(--text-muted); font-size:11px; }

  /* ===== Reações ===== */
  .reactions{
    display:flex;
    flex-wrap:wrap;
    gap:4px;
    margin-top:6px;
  }

  .reaction{
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:2px 8px;
    border-radius:8px;
    background:rgba(79,84,92,.3);
    border:1px solid rgba(79,84,92,.55);
    font-size:13px;
    color:var(--text-normal);
  }

  .reaction.mine{
    background:rgba(88,101,242,.18);
    border-color:var(--brand);
    color:#c9cdfb;
  }

  /* ===== Linha de sistema ===== */
  .system-line{
    display:flex;
    align-items:center;
    gap:8px;
    padding:4px 32px 4px 72px;
    font-size:14px;
    color:var(--text-muted);
  }

  .system-line .sys-icon{
    width:16px;
    height:16px;
    border-radius:50%;
    background:var(--green);
    color:#fff;
    font-size:10px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex:none;
  }

  .system-line strong{ color:var(--text-normal); font-weight:600; }

  /* ===== Painel de sistema Spike (NÃO é mensagem do chat) ===== */
  .system-notice{
    margin:4px 16px 24px;
    padding:16px;
    background:var(--bg-secondary);
    border:1px solid var(--divider);
    border-radius:8px;
    display:flex;
    align-items:flex-start;
    gap:12px;
    box-shadow:0 1px 3px rgba(0,0,0,.3);
  }

  .system-notice-icon{
    flex:none;
    width:36px;
    height:36px;
    border-radius:50%;
    background:linear-gradient(135deg,#5865f2,#3b45c9);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:18px;
  }

  .system-notice-body{ flex:1; min-width:0; }

  .system-notice-title{
    font-size:11px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.5px;
    color:var(--text-muted);
    margin-bottom:4px;
  }

  .system-notice-text{
    font-size:14px;
    line-height:1.45;
    color:var(--text-normal);
  }

  .system-notice-text strong{ color:var(--text-strong); font-weight:600; }

  /* ===== Botões de ação do ticket ===== */
  .actions-buttons{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-top:12px;
  }

  .discord-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    min-height:32px;
    padding:8px 16px;
    border:none;
    border-radius:3px;
    font-family:inherit;
    font-size:14px;
    font-weight:500;
    line-height:1;
    color:#fff;
    cursor:pointer;
    transition:background .15s ease, transform .05s ease;
    user-select:none;
  }

  .discord-btn:active{ transform:translateY(1px); }
  .discord-btn:disabled{ opacity:.55; cursor:not-allowed; }

  .btn-success{ background:#248046; }
  .btn-success:hover:not(:disabled){ background:#1a6334; }

  .btn-danger{ background:#da373c; }
  .btn-danger:hover:not(:disabled){ background:#a12828; }

  .action-feedback{
    margin-top:10px;
    font-size:13px;
    color:#3ddc84;
    opacity:0;
    min-height:16px;
    transition:opacity .2s ease;
    white-space:pre-wrap;
  }
  .action-feedback.visible{ opacity:1; }

  /* ===== Rodapé ===== */
  .footer{
    position:sticky;
    bottom:0;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    padding:10px 16px;
    font-size:12px;
    color:var(--text-muted);
    background:var(--bg-secondary);
    border-top:1px solid rgba(0,0,0,.3);
  }

  .footer strong{ color:var(--text-normal); font-weight:600; }

  /* ===== Responsivo (mobile) ===== */
  @media (max-width:640px){
    body{ font-size:15px; }

    .topbar{ padding:10px 12px; gap:10px; }
    .topbar-text h1{ font-size:15px; }
    .topbar-text p{ font-size:11px; }
    .status-pill{ font-size:10px; padding:3px 8px; }

    .meta{ grid-template-columns:repeat(2, 1fr); }
    .meta-item{ padding:8px 12px; }
    .meta-value{ font-size:13px; }

    .chat{ padding:12px 0 24px; }

    .divider{ margin:12px 12px 6px; font-size:11px; }

    .message{ padding:2px 12px 2px 60px; }
    .message .avatar{ left:12px; width:36px; height:36px; font-size:15px; }
    .hover-time{ left:12px; width:36px; }

    .username{ font-size:15px; }
    .msg-content{ font-size:15px; }
    .msg-content code{ font-size:13px; }

    .reply{ font-size:13px; }
    .reply::before{ left:-34px; width:44px; }

    .embed{ max-width:100%; padding:10px 12px 12px 10px; }
    .embed-title{ font-size:15px; }
    .embed-desc{ font-size:13px; }
    .embed-fields{ grid-template-columns:1fr; gap:6px; }
    .embed-field .field-value{ font-size:13px; }

    .attachment{ max-width:100%; }
    .attach-preview{ height:120px; }

    .system-line{ padding:4px 12px 4px 60px; font-size:13px; }

    .system-notice{ margin:4px 12px 20px; padding:12px; gap:10px; }
    .system-notice-icon{ width:32px; height:32px; font-size:16px; }
    .system-notice-text{ font-size:13px; }

    .discord-btn{ flex:1 1 auto; min-width:130px; }

    .footer{ font-size:11px; padding:8px 12px; }
  }

  @media (max-width:380px){
    .message{ padding-left:52px; }
    .message .avatar{ width:32px; height:32px; left:10px; }
    .hover-time{ left:10px; width:32px; }
    .system-line{ padding-left:52px; }
  }

  .avatar-image{ width:100%; height:100%; object-fit:cover; }
  .embed-author{ color:var(--text-strong); font-size:12px; font-weight:600; margin-bottom:6px; }
  .embed-title a{ color:inherit; text-decoration:none; }
  .embed-title a:hover{ text-decoration:underline; }
  .embed-thumbnail{ float:right; width:76px; height:76px; margin:0 0 8px 12px; border-radius:4px; object-fit:cover; }
  .embed-image-link{ display:block; margin-top:10px; }
  .embed-image{ display:block; max-width:min(100%,560px); max-height:360px; border-radius:4px; object-fit:contain; }
  .embed-footer{ clear:both; }
  .attachment{ display:block; width:max-content; max-width:min(100%,520px); color:var(--link); text-decoration:none; }
  .attachment:hover .attach-name{ text-decoration:underline; }
  .attach-preview img{ display:block; max-width:100%; max-height:320px; border-radius:4px; object-fit:contain; }
  .attach-name small{ color:var(--text-muted); }
  .reactions{ flex-wrap:wrap; }
  .spoiler{ color:var(--text-muted); background:#202127; border-radius:3px; padding:0 3px; cursor:pointer; }
  .spoiler span{ color:var(--text-normal); filter:blur(4px); }
  .spoiler[open] span{ filter:none; }
  .spoiler summary{ display:inline; list-style:none; }
  .spoiler summary::-webkit-details-marker{ display:none; }
  .spoiler[open] summary{ display:none; }
  .load-status{ padding:14px 16px 8px; text-align:center; color:var(--text-muted); font-size:13px; }
  .load-more{ display:block; margin:8px auto 22px; padding:9px 15px; border:1px solid #4e5d94; border-radius:4px; color:#fff; background:var(--brand); font:600 13px/1.2 "gg sans","Noto Sans","Helvetica Neue",Helvetica,Arial,sans-serif; cursor:pointer; }
  .load-more:hover{ background:#4752c4; }
  .load-more:disabled{ opacity:.6; cursor:wait; }
  .load-more[hidden]{ display:none; }
  .closure-note{ display:grid; gap:5px; margin:16px; padding:12px 14px; border-left:3px solid #ed4245; background:var(--bg-secondary); color:var(--text-normal); font-size:13px; }
  .closure-note strong{ color:var(--text-strong); }
  .access-error{ min-height:100vh; align-items:center; justify-content:center; padding:28px; text-align:center; }
  .access-error h1{ color:var(--text-strong); }
  .access-error p{ max-width:560px; color:var(--text-muted); }
