/* =================== v3: colunas, ganchos, concorrentes, simulador, vendas, portal =================== */

/* tabela de métricas (gerenciador) */
.mt-wrap { max-height: max(460px, calc(100vh - 230px)); overflow: auto; }
.tbl.mt { font-size: 13px; }
.tbl.mt th { white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.tbl.mt td { white-space: nowrap; }
.tbl.mt td.txt { white-space: normal; min-width: 140px; max-width: 260px; font-size: 12.5px; color: var(--text-2); }
.tbl.mt .namecol { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 280px; max-width: 340px; box-shadow: 1px 0 0 var(--border); }
.tbl.mt th.namecol { z-index: 3; }
.tbl.mt tbody tr:hover td.namecol { background: var(--surface-2); }
.tbl.mt tr.lvl1 td.namecol, .tbl.mt tr.lvl1 td { background: var(--surface-2); }
.tbl.mt tr.lvl1 td.namecol { padding-left: 30px; }
.tbl.mt tr.lvl2 td.namecol { padding-left: 56px; }
.tbl.mt tfoot td { position: sticky; bottom: 0; background: var(--surface-2); border-top: 2px solid var(--border-strong); font-weight: 600; z-index: 1; }
.tbl.mt tfoot td.namecol { z-index: 2; background: var(--surface-2); }
.tbl.mt .nm.ell { max-width: 230px; }
.tbl.mt .sm.ell { max-width: 230px; }
.info-i { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong); font-size: 9.5px; font-weight: 700; color: var(--muted); font-style: normal; vertical-align: 1px; margin-left: 2px; }
.lvl-tabs button { font-weight: 600; }

/* seletor de colunas */
.cp { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-top: 14px; }
.cp-left { padding: 14px 16px; border-right: 1px solid var(--border); display: grid; gap: 10px; align-content: start; }
.cp-left .input { width: 100%; }
.cp-groups { max-height: 52vh; overflow: auto; display: grid; gap: 14px; padding-right: 4px; }
.cp-gt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.cp-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.cp-item:hover { background: var(--surface-2); }
.cp-item input { accent-color: var(--accent); }
.cp-right { padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.cp-h { font-weight: 600; font-size: 13.5px; }
.cp-sel { max-height: 56vh; overflow: auto; display: grid; gap: 4px; }
.cp-s { display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface-2); }
.cp-s span { flex: 1; }
.cp-s .icon-btn { width: 24px; height: 24px; font-size: 13px; }
.cp-s .icon-btn:disabled { opacity: .35; cursor: default; }
.cp-foot { padding-top: 14px; flex-wrap: wrap; }
.cp-foot .input { width: 260px; }

/* cards de cliente: ROAS real */
.ccard-real { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.ccard-real b { font-size: 14px; }

/* ganchos vencedores */
.hook-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding: 18px; }
.hook-card { display: grid; grid-template-columns: 120px 1fr; overflow: hidden; box-shadow: none; }
.hook-card[data-ad] { cursor: pointer; }
.hook-media { position: relative; background: var(--surface-2); align-self: start; margin: 12px 0 12px 12px; border-radius: 10px; overflow: hidden; }
.hook-media .cr-img { aspect-ratio: 1; height: auto; }
.hook-media .cr-img img { width: 100%; height: 100%; object-fit: cover; }
.hook-score { position: absolute; left: 8px; top: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; border-radius: 8px; padding: 2px 8px; }
.hook-body { padding: 12px 14px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.hook-text { font-size: 15px; font-weight: 650; line-height: 1.35; }
.hook-why { display: flex; flex-wrap: wrap; gap: 4px; }
.hook-why .badge { white-space: normal; height: auto; padding: 2px 8px; }
.hook-note { width: 100%; height: auto; padding: 8px 10px; font-size: 13px; resize: vertical; }
.hook-card .input.sm { width: 100%; }

/* concorrentes */
.comp-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr auto; gap: 12px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.comp-stats { display: grid; grid-template-columns: auto auto 1fr; gap: 18px; margin-top: 12px; align-items: end; }
.comp-stats div { display: grid; gap: 2px; }
.comp-stats span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.comp-stats b { font-size: 17px; }
.comp-stats em { font-style: normal; font-size: 12px; }
.comp-stats .spark { width: 120px; height: 28px; }
.comp-ads { display: grid; gap: 8px; margin-top: 12px; max-height: 340px; overflow: auto; }
.comp-ad { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }

/* simulador */
.sim-top { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-bottom: 16px; align-items: start; }
.sim-slider { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.sim-slider label { font-size: 13.5px; }
.sim-slider b { font-size: 20px; color: var(--accent-text); }
.sim-slider input[type=range] { width: 100%; accent-color: var(--accent); }
.sim-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.sim-kpis div { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 2px; }
.sim-kpis span { font-size: 11.5px; color: var(--muted); }
.sim-kpis b { font-size: 16px; }
.sim-kpis em { font-style: normal; font-size: 12px; }
.tbl tr.sim-on td { background: var(--accent-soft); font-weight: 600; }
.sim-note { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.sim-note p, .sim-note ol { margin: 6px 0 0; }
.sim-note ol { padding-left: 18px; }

/* prévia do resumo */
.dg-frame { width: 100%; height: 62vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f4f5f7; }
.dg-wa { white-space: pre-wrap; font: 13.5px/1.5 inherit; font-family: inherit; background: #e7fbe6; color: #111; padding: 14px; border-radius: var(--radius-sm); max-height: 62vh; overflow: auto; margin: 0; }

@media (max-width: 1100px) {
  .comp-form { grid-template-columns: 1fr 1fr; }
  .sim-top { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .cp { grid-template-columns: 1fr; }
  .cp-left { border-right: 0; border-bottom: 1px solid var(--border); }
  .cp-groups, .cp-sel { max-height: 34vh; }
  .hook-grid { grid-template-columns: 1fr; padding: 12px; }
  .hook-card { grid-template-columns: 96px 1fr; }
  .comp-grid { grid-template-columns: 1fr; }
  .comp-form { grid-template-columns: 1fr; }
  .tbl.mt .namecol { min-width: 200px; max-width: 220px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .mt-wrap { max-height: none; }
}
