/* ================= CRIAR MENSAGEM / CRIAR EMBED =================
   Carregado depois do app.css. Usa os mesmos tokens (--sky, --line, ...). */
.nav-curto { display: none; }
.msg-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.msg-lado { position: sticky; top: 24px; }
.lbl { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lbl label { font-size: 13px; font-weight: 700; color: var(--muted); }
.opc { font-weight: 600; color: var(--dim); font-size: 12px; }
.count { font-size: 12px; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.count.over { color: var(--danger); }
.count.total { padding: 4px 10px; border-radius: 999px; background: #f2f3f5; }
.count.total.over { background: var(--danger-soft); }
.aviso { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 14px; }

/* barra de formatação */
.mdbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px;
  border: 1px solid var(--line-2); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: #f7f8fa;
}
.mdbar + .textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.mdbar button {
  width: 32px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none;
  color: var(--muted); cursor: pointer; transition: background 0.12s, color 0.12s, transform 0.2s var(--spring);
}
.mdbar button:hover { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }
.mdbar button:active { transform: scale(0.9); }
.mdbar-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }

/* cor */
.cores { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cor {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: var(--c); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line-2); transition: transform 0.2s var(--spring), box-shadow 0.15s;
}
.cor:hover { transform: scale(1.12); }
.cor.on { box-shadow: 0 0 0 2px var(--sky-dark); transform: scale(1.08); }
.cor-livre {
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden; cursor: pointer; position: relative;
  background: conic-gradient(#ed4245, #fee75c, #57f287, #18b0fd, #5865f2, #eb459e, #ed4245); box-shadow: 0 0 0 1px var(--line-2);
}
.cor-livre input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.cor-hex { width: 104px; flex: none; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }

/* seções recolhíveis */
details.sec > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after {
  content: ''; width: 9px; height: 9px; border-right: 2.4px solid var(--dim); border-bottom: 2.4px solid var(--dim);
  transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform 0.25s var(--spring); flex: none;
}
details.sec[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.sec[open] > summary { margin-bottom: 16px; }
.sec-info { margin-left: auto; color: var(--dim); font-size: 13px; font-weight: 700; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* campos do embed */
.ef { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: #fcfcfd; animation: rise 0.3s var(--ease) both; }
.ef-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ef-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; color: var(--muted); cursor: pointer; transition: background 0.12s, transform 0.2s var(--spring);
}
.icon-btn:hover:not(:disabled) { background: #f5f5f7; transform: translateY(-1px); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn.danger { color: var(--danger); border-color: #f3c4c4; }
.icon-btn.danger:hover { background: var(--danger-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--sky); margin: 0; flex: none; }

/* ações e resultado */
.msg-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.msg-erros {
  margin: 14px 0 0; padding: 10px 14px 10px 30px; border-radius: var(--radius-sm); background: var(--danger-soft);
  color: var(--danger); font-size: 13.5px; font-weight: 600; display: grid; gap: 3px;
}
.msg-ok {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 14px; animation: pop-in 0.35s var(--spring) both;
}
.msg-ok svg { flex: none; }
.msg-ok a { text-decoration: underline; }
.rascunho-info { margin: 10px 0 0; text-align: right; min-height: 18px; }
.toast-link { color: var(--sky-dark); text-decoration: underline; white-space: nowrap; }

/* atalhos no início dos outros servidores */
.atalhos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.atalho { display: flex; align-items: center; gap: 16px; padding: 22px; }
.atalho:hover { transform: translateY(-3px); box-shadow: 0 10px 24px -12px rgba(16, 24, 40, 0.2); }
.atalho > svg { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--sky-soft); color: var(--sky-dark); flex: none; }
.atalho span { display: flex; flex-direction: column; min-width: 0; }
.atalho strong { font-size: 17px; }
.atalho small { color: var(--muted); font-size: 14px; }

/* caixa de confirmação */
dialog.confirm {
  border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); color: var(--text); animation: pop-in 0.3s var(--spring) both;
}
dialog.confirm::backdrop { background: rgba(16, 24, 40, 0.45); animation: fade-in 0.2s ease both; }
dialog.confirm h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; }
dialog.confirm p { margin: 0 0 20px; color: var(--muted); }
dialog.confirm b { color: var(--text); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* seletor de emojis */
.emoji-pop {
  position: fixed; z-index: 60; width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18); padding: 10px; display: flex; flex-direction: column; gap: 8px;
  animation: drop 0.2s var(--ease);
}
.ep-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; background: #f2f3f5; border-radius: 10px; }
.ep-tabs button { height: 32px; border: 0; border-radius: 8px; background: none; font-weight: 700; color: var(--muted); cursor: pointer; }
.ep-tabs button.on { background: #fff; color: var(--sky-dark); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
.ep-busca { height: 38px; }
.ep-grupos { display: flex; justify-content: space-between; }
.ep-grupos button { width: 32px; height: 30px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 17px; filter: grayscale(1); opacity: 0.6; }
.ep-grupos button.on, .ep-grupos button:hover { filter: none; opacity: 1; background: var(--sky-soft); }
.ep-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; height: 250px; overflow-y: auto; align-content: start; }
.ep-e { aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; cursor: pointer; padding: 4px; transition: background 0.1s, transform 0.15s var(--spring); }
.ep-e:hover { background: #f2f3f5; transform: scale(1.15); }
.ep-e img { width: 28px; height: 28px; object-fit: contain; }
.ep-u { font-size: 24px; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.ep-vazio { grid-column: 1 / -1; text-align: center; color: var(--dim); font-size: 14px; padding: 30px 10px; }

/* prévia no estilo do Discord (tema escuro) */
.dc { background: #313338; border-radius: 10px; padding: 14px 14px 16px; color: #dbdee1; font-family: 'gg sans', 'Nunito Sans', system-ui, sans-serif; font-size: 15px; line-height: 1.375; overflow: hidden; }
.dc-msg { display: flex; gap: 14px; }
.dc-av { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.dc-body { flex: 1; min-width: 0; }
.dc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.dc-head strong { color: #f2f3f5; font-weight: 600; }
.dc-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; line-height: 1.3; }
.dc-time { color: #949ba4; font-size: 12px; }
.dc-text { overflow-wrap: anywhere; }
.dc-vazio { color: #80848e; font-style: italic; }
.dc-embed {
  display: flex; gap: 16px; margin-top: 6px; max-width: 520px; background: #2b2d31; border-radius: 4px;
  border-left: 4px solid var(--ec); padding: 10px 14px 14px 12px;
}
.dc-e-main { flex: 1; min-width: 0; display: grid; gap: 8px; font-size: 14px; overflow-wrap: anywhere; align-content: start; }
.dc-e-author { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; margin-top: 4px; }
.dc-e-author img { width: 24px; height: 24px; border-radius: 50%; }
.dc-e-author a:hover, .dc-e-title a:hover { text-decoration: underline; }
.dc-e-title { font-size: 16px; font-weight: 700; color: #f2f3f5; margin-top: 4px; }
.dc-e-title a { color: #00a8fc; }
.dc-e-fields { display: grid; gap: 8px; }
.dc-e-row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; }
.dc-e-fname { font-weight: 700; color: #f2f3f5; margin-bottom: 2px; }
.dc-e-img { max-width: 100%; max-height: 300px; border-radius: 4px; object-fit: contain; object-position: left; margin-top: 8px; }
.dc-e-thumb { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; flex: none; margin-top: 4px; }
.dc-e-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #dbdee1; margin-top: 4px; }
.dc-e-foot img { width: 20px; height: 20px; border-radius: 50%; }

/* markdown */
.dc strong { font-weight: 700; }
.md-l { min-height: 1.375em; }
.md-h1, .md-h2, .md-h3 { font-weight: 700; color: #f2f3f5; margin: 8px 0 4px; line-height: 1.25; }
.md-h1 { font-size: 24px; }
.md-h2 { font-size: 20px; }
.md-h3 { font-size: 16px; }
.md-sub { font-size: 12px; color: #949ba4; }
.md-q { margin: 0; padding: 0 0 0 12px; border-left: 4px solid #4e5058; }
.md-ul, .md-ol { margin: 2px 0; padding-left: 22px; }
.md-code { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 0 3px; font-family: Consolas, 'Courier New', monospace; font-size: 0.85em; }
.dc-embed .md-code, .dc-embed .md-pre { background: #1e1f22; }
.md-pre { margin: 4px 0; padding: 8px; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; font-family: Consolas, 'Courier New', monospace; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.md-a { color: #00a8fc; }
.md-a:hover { text-decoration: underline; }
.md-emoji { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }
.md-men { --mc: #5865f2; background: color-mix(in srgb, var(--mc) 30%, transparent); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.md-men.role { color: var(--mc); }
.md-ts { background: rgba(255, 255, 255, 0.06); border-radius: 3px; padding: 0 2px; }
.md-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; padding: 0 2px; cursor: pointer; transition: color 0.15s, background 0.15s; }
.md-spoiler:hover { background: #26282c; }
.md-spoiler:focus { color: inherit; background: rgba(255, 255, 255, 0.1); outline: none; }
.md-spoiler .md-emoji { opacity: 0; }
.md-spoiler:focus .md-emoji { opacity: 1; }

@media (max-width: 1150px) {
  .msg-grid { grid-template-columns: minmax(0, 1fr); }
  .msg-lado { position: static; }
}
@media (max-width: 860px) {
  .sidenav { grid-auto-columns: minmax(0, 1fr); gap: 2px; padding-left: 6px; padding-right: 68px; }
  .nav-item { padding-left: 0; padding-right: 0; }
  .nav-item:has(.nav-curto) .nav-label { display: none; }
  .nav-curto { display: block; max-width: 100%; overflow: hidden; text-overflow: clip; white-space: nowrap; }
  /* Com 6 abas (Rádio Equipe) o texto fica um pouco menor para caber. */
  .sidenav:has(.nav-item:nth-child(6)) .nav-item { font-size: 9.5px; letter-spacing: -0.2px; }
  .atalhos { grid-template-columns: minmax(0, 1fr); }
  .emoji-pop { left: 8px !important; right: 8px; top: auto !important; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; }
  .ep-grid { height: 240px; }
  .msg-acoes .btn { flex: 1; }
  .mdbar button { width: 36px; height: 36px; }
  .icon-btn { width: 40px; height: 40px; }
  .dc { padding: 12px 10px 14px; }
  .dc-msg { gap: 10px; }
  .dc-embed { gap: 10px; padding-right: 10px; }
  .dc-e-thumb { width: 56px; height: 56px; }
}
