/* ============================================================
   Clube Trader IA — menu lateral + telas das funcionalidades
   (Inteligência de mercado, Calendário, Academia, Psicologia, Diário)
   Usa só os tokens de style.css: acompanha o layout prata e o verde.
   ============================================================ */
:root { --header-h: 58px; --side-w: 248px; }

/* ---------- casca: topo fino + lateral + conteúdo ---------- */
.header .header-row { padding-inline: 20px; gap: 14px; }
.shell { display: flex; align-items: flex-start; }
.shell-main { flex: 1; min-width: 0; }
#lateral { flex: 0 0 var(--side-w); position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); z-index: 40; }
#lateral:empty, body.is-admin #lateral { display: none; }
.side {
  height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px 16px;
  background: var(--bg-2); border-right: 1px solid var(--line); scrollbar-width: thin;
}
.side-rotulo { font: 700 11px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); padding: 4px 12px 12px; }
.side-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: var(--r-md);
  font-weight: 600; font-size: 14.5px; line-height: 1.25; color: var(--muted); border: 1px solid transparent;
}
.side-item svg { flex: none; }
.side-item > span:first-of-type { flex: 1; min-width: 0; }
.side-item:hover { color: var(--text); background: var(--surface-2); }
.side-item.active { background: var(--btn-bg); color: var(--accent-ink); box-shadow: 0 6px 22px -12px var(--accent-glow); }
.side-selo { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); flex: none; }
.side-selo em { font: 700 10px/1 var(--f-mono); font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 4px 6px; border-radius: 4px; }
.side-item.active .side-selo, .side-item.active .side-selo em { color: var(--accent-ink); background: none; }
.side-pe { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.side-mobile { display: none; gap: 10px; }
.side-mobile .toggle-group { justify-self: start; }
.side-fundo { display: none; }

/* a partir daqui a lateral vira gaveta, aberta pelo botão ☰ do topo */
@media (max-width: 1180px) {
  .menu-btn { display: grid; }
  #lateral { position: fixed; inset: 0; top: 0; height: auto; z-index: 60; pointer-events: none; visibility: hidden; }
  .side { position: absolute; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); padding-top: calc(18px + env(safe-area-inset-top, 0px)); transform: translateX(-100%); transition: transform .22s ease; box-shadow: 20px 0 60px -20px #000; }
  .side-fundo { display: block; position: absolute; inset: 0; background: rgb(0 0 0 / .6); opacity: 0; transition: opacity .22s ease; }
  body.lateral-aberta #lateral { pointer-events: auto; visibility: visible; }
  body.lateral-aberta .side { transform: none; }
  body.lateral-aberta .side-fundo { opacity: 1; }
  body.lateral-aberta { overflow: hidden; }
}
@media (max-width: 920px) { .side-mobile { display: grid; } }
@media (prefers-reduced-motion: reduce) { .side, .side-fundo { transition: none; } }

/* ---------- peças comuns das telas ---------- */
.ws { padding-bottom: 72px; }
.ws-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.ws-head h1 { font-size: clamp(26px, 3vw, 38px); max-width: 26ch; }
.ws-head .lead { margin-top: 10px; }
.ws-aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 18px; border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.ws-aviso svg { flex: none; color: var(--warn); }
.ws-abas { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.ws-abas .chip-btn { display: inline-flex; align-items: center; }
.chip-btn[aria-current="true"] { background: var(--surface-3); color: var(--text); border-color: var(--accent); }
.ws-cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ws-cols-inv { grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); }
.ws-meio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ws-cols + .panel, .ws-cols + .disclaimer, .panel + .ws-cols, .ws-kpis + .panel, .ws-kpis + .ws-cols, .ws-kpis + .ws-cards { margin-top: 18px; }
.ws .panel + .panel { margin-top: 18px; }
.ws-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.ws-kpis > div { background: var(--surface); padding: 18px 20px; }
.ws-kpis .l { font-size: 13px; font-weight: 600; color: var(--muted); }
.ws-kpis .v { font-size: 26px; font-weight: 700; margin-top: 6px; }
.ws-kpis .s { font-size: 12px; color: var(--faint); margin-top: 2px; }
.ws-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; font: 600 11px/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.ws-meta b { color: var(--muted); }
.ws-lista { display: grid; gap: 12px; }
.ws-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.ws-cards .panel + .panel { margin-top: 0; }
.ws-prog { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.ws-prog span { display: block; height: 100%; background: var(--btn-bg); }
.ws-sep { width: 1px; height: 22px; background: var(--line-2); margin-inline: 4px; }
.modal.modal-lg { width: min(640px, 100%); }
.modal.modal-lg p { color: var(--text-2); }

/* ---------- inteligência de mercado ---------- */
.ws-tv-faixa { min-height: 46px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ws-tv-w { min-height: 520px; }
.ws-tv-w.ws-tv-mapa { min-height: 480px; }
/* widget do TradingView em iframe próprio; o excesso (logotipo e botões) fica fora da caixa */
.ws-tvc { overflow: hidden; position: relative; }
.ws-tvc iframe { display: block; border: 0; color-scheme: light; }
.ws-noticias { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; display: grid; }
.ws-noticias li { display: grid; gap: 4px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.ws-noticias li:last-child { border-bottom: 0; }
.ws-noticias b { font-size: 14.5px; line-height: 1.35; font-weight: 600; }
.ws-noticias .note { font-size: 12.5px; }
.ws-noticias .chip { padding: 0 6px; font-size: 11px; }
.ws-leitura { color: var(--muted); font-size: 13px; min-width: 220px; }
.ws-briefing { text-align: left; display: grid; gap: 8px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); width: 100%; }
.ws-briefing:hover { border-color: var(--line-2); }
.ws-briefing h3 { font-size: 17px; }
.ws-briefing p { font-size: 14px; color: var(--muted); }

/* ---------- calendário econômico ---------- */
.ws-sent { position: relative; display: grid; justify-items: center; }
.ws-medidor { width: min(280px, 100%); }
.ws-sent-v { display: grid; justify-items: center; margin-top: -6px; }
.ws-sent-v b { font-size: 40px; line-height: 1; }
.ws-sent-v span { color: var(--muted); font-weight: 700; margin-top: 4px; }
.ws-sent-h { margin: 16px 0 12px; display: grid; gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; }
.ws-sent-h > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 11px 14px; background: var(--surface-2); }
.ws-sent-h dt { font-size: 13px; color: var(--muted); }
.ws-sent-h dd { margin: 0; font-size: 13px; color: var(--muted); text-align: right; }
.ws-sent-h dd b { color: var(--text); font-size: 15px; }
.ws-sent-h dd b.pos { color: var(--gain); } .ws-sent-h dd b.neg { color: var(--loss); }
.ws-termo-t { font: 700 12px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.ws-termo { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.ws-termo li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.ws-termo li > div:first-child { display: grid; gap: 2px; min-width: 0; }
.ws-termo li b { font-size: 14px; }
.ws-termo li .note { font-size: 12px; }
.ws-termo-b { height: 6px; border-radius: 3px; background: var(--surface-4); overflow: hidden; }
.ws-termo-b i { display: block; height: 100%; background: var(--text-2); border-radius: 3px; }
.ws-termo-p { font-size: 13px; color: var(--muted); }
.ws-tv { min-height: 640px; }

/* ---------- academia e exercícios ---------- */
.ws-trilha { display: grid; gap: 12px; align-content: start; transition: border-color .2s ease, transform .2s ease; }
.ws-trilha:hover { border-color: var(--line-2); transform: translateY(-2px); }
.ws-trilha p { color: var(--muted); font-size: 14px; }
.ws-aula > summary { display: flex; align-items: center; gap: 14px; cursor: pointer; list-style: none; }
.ws-aula > summary::-webkit-details-marker { display: none; }
.ws-aula[open] > summary { margin-bottom: 14px; }
.ws-aula > p { color: var(--text-2); }
.ws-aula .checks { margin-block: 12px 16px; }
.ws-n { font-size: 13px; color: var(--faint); font-weight: 700; flex: none; }
.ws-aula-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ws-aula-t small { color: var(--muted); font-size: 13px; }

/* ---------- psicologia ---------- */
.ws-result { padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--line-2); display: grid; gap: 6px; }
.ws-result.n0 { border-left-color: var(--gain); }
.ws-result.n1 { border-left-color: var(--warn); }
.ws-result.n2 { border-left-color: var(--loss); }
.ws-result h3 { font-size: 16px; }
.ws-result p { font-size: 14px; color: var(--muted); }
.ws-pausa { display: grid; gap: 16px; justify-items: start; }
.ws-pausa h2 { font-size: clamp(26px, 3.4vw, 40px); }
.ws-relogio { font-size: clamp(56px, 10vw, 104px); font-weight: 700; line-height: 1; }
.ws textarea { height: auto; padding-block: 12px; resize: vertical; }

/* ---------- diário ---------- */
.ws-curva { width: 100%; height: auto; display: block; }
.ws-file { cursor: pointer; }
.ws-file:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 980px) {
  .ws-cols, .ws-cols-inv, .ws-meio { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ws .form-grid { grid-template-columns: minmax(0, 1fr); }
  .ws-head { align-items: flex-start; }
}

/* ---------- Telegram: postagens do canal embutidas ---------- */
.tg-posts { display: grid; gap: 12px; min-width: 0; }
.tg-posts h3 { font-size: 16px; }
.tg-canal { padding: 16px; gap: 12px; min-width: 0; }
.tg-canal h3 { font-size: 16px; }
.tg-canal-head { display: flex; align-items: center; gap: 10px; }
.tg-canal-head .nm { font-weight: 700; font-size: 14px; }
.tg-canal-head .mm { font-size: 12px; color: var(--muted); }
.tg-canal-sep { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tg-canal-sep::before, .tg-canal-sep::after { content: ""; flex: 1; height: 1px; background: rgba(42,171,238,.3); }
.tg-post-wrap { display: grid; gap: 2px; min-width: 0; }
.tg-post-box { position: relative; overflow: hidden; border-radius: var(--r-lg); }
.tg-post-box.corte::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--surface)); }
.tg-mais { justify-self: start; background: none; border: 0; padding: 4px 2px; color: var(--telegram); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tg-mais:hover { text-decoration: underline; }
.tg-mais[hidden] { display: none; }
.tg-post { display: block; width: 100%; border: 0; border-radius: var(--r-lg); background: var(--surface); color-scheme: dark; }
.tg-pagina { max-width: 620px; margin-top: 28px; }

/* ---------- Calendário econômico: card único estilo Investing (27/10/2026) ---------- */
.ws-cols-cal { grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr); }
.ws-cal-filtros { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ws-cal-pers { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-cal-pill { height: 34px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.ws-cal-pill:hover { color: var(--text); border-color: var(--line-2); }
.ws-cal-pill[aria-pressed="true"] { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-3); }
.ws-cal-dd { position: relative; }
.ws-cal-dd summary { list-style: none; display: flex; gap: 8px; align-items: center; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; font-size: 13px; min-width: 190px; }
.ws-cal-dd summary::-webkit-details-marker { display: none; }
.ws-cal-dd summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.ws-cal-dd[open] summary::after { content: "▴"; }
.ws-cal-dd-m { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; display: grid; padding: 6px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); box-shadow: 0 10px 30px rgb(0 0 0 / .35); }
.ws-cal-dd-m label { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.ws-cal-dd-m label:hover { background: var(--surface-2); }
.ws-cal-dd-m input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.ws-cal-rel { margin: 0 0 10px; font-size: 12.5px; }
.ws-cal-tab { overflow-x: auto; margin: 0 -4px; }
.ws-cal { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 13.5px; }
.ws-cal th, .ws-cal td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ws-cal thead th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ws-cal .r { text-align: right; }
.ws-cal td:first-child { width: 58px; white-space: nowrap; }
.ws-cal-dia th { text-align: center; font-weight: 700; font-size: 13px; color: var(--text); background: var(--surface-2); }
.ws-cal-m { display: inline-block; min-width: 38px; font-size: 12px; font-weight: 700; color: var(--muted); }
.ws-cal-ev { min-width: 220px; }
.ws-cal-ant { color: var(--muted); }
.ws-cal tr.passou td { opacity: .78; }
.ws-cal-imp { white-space: nowrap; letter-spacing: 1px; font-size: 13px; }
.ws-cal-imp i { font-style: normal; color: var(--faint); opacity: .55; }
.ws-cal-imp i.on { color: var(--text); opacity: 1; }
.ws-cal-agora td { padding: 0; border-bottom: 2px solid var(--accent); height: 0; position: relative; }
.ws-cal-agora span { position: absolute; left: 0; top: -9px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: var(--bg, #000); }
@media (max-width: 1100px) { .ws-cols-cal { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .ws-cal-p { padding-inline: 12px; }
  .ws-cal-tab { margin: 0; }
  .ws-cal { min-width: 0; font-size: 12.5px; }
  .ws-cal th, .ws-cal td { padding: 8px 4px; }
  .ws-cal thead th { font-size: 11px; }
  .ws-cal td:first-child { width: 40px; }
  .ws-cal-ev { min-width: 0; word-break: break-word; }
  .ws-cal-m { min-width: 0; font-size: 11px; }
  .ws-cal-imp { font-size: 10px; letter-spacing: 0; }
  .ws-cal-dd, .ws-cal-dd summary { width: 100%; }
}
/* Diário → Registrar operações: escolha digitar/arquivo e tela de revisão do arquivo (23/10/2026) */
.modal.modal-xl { width: min(1100px, 100%); }
.modal .seg { justify-self: start; flex-wrap: wrap; }
.ws-imp { display: grid; gap: 12px; }
.ws-imp-tab { max-height: min(56vh, 560px); overflow: auto; }
.ws-imp-tab th { position: sticky; top: 0; background: var(--surface); z-index: 1; vertical-align: bottom; }
.ws-imp-tab td, .ws-imp-tab th { white-space: nowrap; }
.ws-imp-tab td input:not([type="checkbox"]) { min-width: 200px; width: 100%; padding: 6px 8px; font-size: 13px; }
.ws-imp-c { text-align: center; }
.ws-imp-todos { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; line-height: 1.25; cursor: pointer; }
.ws-dica-aba { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.ws-kpis .l .pn-i, .ws-sent-h dt .pn-i { vertical-align: 1px; }
