/* Painel da Sala BTC (02/12/2026, Luis: “deixa o layout como se estivesse no Discord”).
   Cores no padrão do Discord; claro/escuro segue o aparelho (prefers-color-scheme) ou ?tema=claro|escuro. */
:root {
  --bg-primary: #313338; --bg-secondary: #2b2d31; --bg-tertiary: #1e1f22; --bg-floating: #111214;
  --hover: rgba(78,80,88,.3); --selected: rgba(78,80,88,.6); --divider: rgba(255,255,255,.06);
  --text: #dbdee1; --header: #f2f3f5; --header-2: #b5bac1; --muted: #949ba4; --channel: #80848e;
  --embed: #2b2d31; --input: #1e1f22; --brand: #5865f2; --brand-hover: #4752c4;
  --green: #23a55a; --red: #f23f43; --yellow: #f0b232; --link: #00a8fc;
  --chip-green-bg: rgba(35,165,90,.16); --chip-red-bg: rgba(242,63,67,.16); --chip-gray-bg: rgba(148,155,164,.16);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg-primary: #ffffff; --bg-secondary: #f2f3f5; --bg-tertiary: #e3e5e8; --bg-floating: #ffffff;
  --hover: rgba(116,127,141,.16); --selected: rgba(116,127,141,.3); --divider: rgba(6,6,7,.08);
  --text: #313338; --header: #060607; --header-2: #4e5058; --muted: #5c5e66; --channel: #5c5e66;
  --embed: #f2f3f5; --input: #e3e5e8; --link: #006ce7;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg-primary); color: var(--text); font: 15px/1.375 "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }

/* Estrutura: barra de servidores | canais | conteúdo */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.rail { width: 72px; flex: none; background: var(--bg-tertiary); padding: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rail img { width: 48px; height: 48px; border-radius: 16px; display: block; }
.rail .pill { position: relative; }
.rail .pill::before { content: ""; position: absolute; left: -16px; top: 4px; width: 4px; height: 40px; border-radius: 0 4px 4px 0; background: var(--header); }
.sidebar { width: 240px; flex: none; background: var(--bg-secondary); display: flex; flex-direction: column; }
.guild { height: 48px; padding: 0 16px; display: flex; align-items: center; font-weight: 600; color: var(--header); box-shadow: 0 1px 0 var(--divider); }
.channels { flex: 1; overflow-y: auto; padding: 8px 8px; }
.cat { margin: 16px 0 4px 8px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--channel); }
.cat:first-child { margin-top: 4px; }
.chan { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border-radius: 4px; color: var(--channel); font-weight: 500; cursor: pointer; margin: 1px 0; }
.chan:hover { background: var(--hover); color: var(--text); }
.chan.on { background: var(--selected); color: var(--header); }
.chan .h { font-size: 20px; width: 20px; text-align: center; opacity: .8; font-weight: 400; }
.userbar { height: 52px; flex: none; background: color-mix(in srgb, var(--bg-tertiary) 60%, var(--bg-secondary)); display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; }
.userbar .who { flex: 1; min-width: 0; line-height: 1.2; }
.userbar .who b { display: block; color: var(--header); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbar .who small { color: var(--muted); font-size: 12px; }
.icon-btn { background: none; border: 0; color: var(--header-2); width: 32px; height: 32px; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-primary); }
.topbar { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; box-shadow: 0 1px 0 var(--divider), 0 1.5px 0 rgba(0,0,0,.05); }
.topbar .h { font-size: 24px; color: var(--channel); font-weight: 400; line-height: 1; }
.topbar h1 { margin: 0; font-size: 16px; font-weight: 600; color: var(--header); white-space: nowrap; }
.topbar .topic { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--divider); }
.menu-btn, .back-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 16px 16px 32px; }
.wrap { max-width: 1100px; }
.backdrop { display: none; }

/* Mensagens do robô (como no canal) */
.msg { display: flex; gap: 16px; padding: 4px 0 12px; }
.msg .bot-av { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.msg .body { flex: 1; min-width: 0; }
.msg .meta { display: flex; align-items: center; gap: 6px; }
.msg .name { color: var(--header); font-weight: 600; }
.tag { background: var(--brand); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 4px; border-radius: 3px; text-transform: uppercase; }
.msg .time { color: var(--muted); font-size: 12px; }

/* Embeds (cards) */
.embed { margin-top: 6px; background: var(--embed); border-left: 4px solid var(--channel); border-radius: 4px; padding: 10px 16px 12px 12px; max-width: 560px; }
.embed.long { border-left-color: var(--green); } .embed.short { border-left-color: var(--red); }
.embed.click { cursor: pointer; transition: background .1s; } .embed.click:hover { background: color-mix(in srgb, var(--embed) 80%, var(--text) 6%); }
.embed .et { color: var(--header); font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.embed .ed { color: var(--muted); font-size: 13px; margin-top: 2px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px 16px; margin-top: 10px; }
.fields .f b { display: block; color: var(--header); font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.fields .f span { font-size: 14px; }
.chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--chip-gray-bg); color: var(--header-2); }
.chip.green { background: var(--chip-green-bg); color: var(--green); } .chip.red { background: var(--chip-red-bg); color: var(--red); }
.pos { color: var(--green); } .neg { color: var(--red); }

/* Abas tipo filtro */
.tabs { display: flex; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 4px 10px; border-radius: 4px; color: var(--header-2); font-weight: 500; cursor: pointer; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.on { background: var(--selected); color: var(--header); }
.divider-date { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; margin: 12px 0 8px; }
.divider-date::before, .divider-date::after { content: ""; flex: 1; height: 1px; background: var(--divider); }

/* Gráfico */
.panel { background: var(--bg-secondary); border-radius: 8px; overflow: hidden; margin-top: 16px; }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
.panel-h .t { color: var(--header); font-weight: 600; margin-right: auto; }
.seg { display: inline-flex; background: var(--bg-tertiary); border-radius: 6px; padding: 2px; }
.seg button { background: none; border: 0; padding: 4px 10px; border-radius: 4px; color: var(--header-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--bg-primary); color: var(--header); }
.btn { background: var(--brand); color: #fff; border: 0; border-radius: 4px; padding: 0 16px; height: 38px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--brand-hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; background: var(--bg-tertiary); color: var(--header-2); }
.btn.sm:hover { color: var(--text); background: var(--hover); }
.btn.block { width: 100%; height: 44px; font-size: 16px; }
.chart { height: 460px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 12px 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px dashed; vertical-align: middle; margin-right: 5px; }
.note { color: var(--muted); font-size: 12px; padding: 0 12px 10px; }

/* Histórico (linhas de mensagem) */
.hist { margin-top: 16px; }
.hist h2, .sec { font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--channel); font-weight: 600; margin: 20px 0 6px; }
.row { display: flex; gap: 12px; padding: 6px 8px; border-radius: 4px; }
.row:hover { background: var(--hover); }
.row .tm { color: var(--muted); font-size: 12px; width: 92px; flex: none; padding-top: 2px; }
.row .tx b { color: var(--header); font-weight: 600; }
.row .tx div { color: var(--muted); font-size: 13px; }

/* Desempenho */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stat { background: var(--bg-secondary); border-radius: 8px; padding: 12px 14px; }
.stat small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.stat b { display: block; font-size: 22px; color: var(--header); font-weight: 700; margin-top: 4px; }
.trades { margin-top: 8px; }
.trade { display: grid; grid-template-columns: 70px 70px 1fr 90px; gap: 8px; align-items: center; padding: 8px; border-radius: 4px; cursor: pointer; }
.trade:hover { background: var(--hover); }
.trade .d { color: var(--muted); font-size: 13px; }
.trade .r { text-align: right; font-weight: 600; }

/* Estados */
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.err { color: var(--red); font-size: 14px; margin: 8px 0; }
.skel { height: 14px; border-radius: 4px; background: var(--hover); margin: 8px 0; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .5; } }

/* Login (padrão da tela de entrada do Discord) */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: var(--brand); padding: 16px; }
.auth-card { width: 100%; max-width: 480px; background: var(--bg-primary); border-radius: 8px; padding: 32px; box-shadow: 0 2px 10px rgba(0,0,0,.2); text-align: center; }
.auth-card img { width: 72px; height: 72px; border-radius: 20px; }
.auth-card h1 { color: var(--header); font-size: 24px; margin: 14px 0 6px; font-weight: 600; }
.auth-card p { color: var(--header-2); margin: 0 0 20px; }
.auth-card label { display: block; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--header-2); margin: 0 0 8px; }
.auth-card input { width: 100%; height: 40px; border: 0; border-radius: 4px; background: var(--input); color: var(--text); padding: 0 10px; font-size: 16px; margin-bottom: 16px; }
.auth-card .alt { display: inline-block; margin-top: 16px; font-size: 14px; background: none; border: 0; color: var(--link); cursor: pointer; }
.auth-card .ok { color: var(--muted); font-size: 14px; margin: -6px 0 14px; text-align: left; }

/* Celular: canais viram gaveta, como no app do Discord */
@media (max-width: 860px) {
  .rail, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 20; transform: translateX(-320px); transition: transform .2s ease; }
  .rail { left: 0; } .sidebar { left: 72px; width: min(260px, calc(100vw - 72px)); }
  .app.drawer .rail, .app.drawer .sidebar { transform: translateX(0); }
  .app.drawer .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; }
  .menu-btn { display: inline-flex; margin-left: -8px; }
  .topbar .topic { display: none; }
  .content { padding: 12px 12px 32px; }
  .chart { height: 58vh; min-height: 320px; }
  .fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .msg { gap: 10px; } .msg .bot-av { width: 34px; height: 34px; }
  .trade { grid-template-columns: 56px 1fr 80px; } .trade .side { display: none; }
  .row .tm { width: 74px; }
}
