:root {
  --navy: #14303F; --navy2: #1C4456; --blue: #226E93; --sky: #3D85C6; --ice: #8EC5E2;
  --bg: #F3F6F9; --card: #fff; --ink: #2F343A; --text: #4A535C; --mute: #6B7480; --line: #DDE4EA;
  --up: #17803f; --down: #b42318;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Montserrat', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button, input, select { font: inherit; color: inherit; }

.brand { font-weight: 800; font-size: 20px; color: #fff; white-space: nowrap; }
.brand span { font-weight: 500; color: var(--ice); font-size: 15px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 16px; }
.login-card { background: #fff; border-radius: 14px; padding: 36px 32px; width: 100%; max-width: 380px; }
.login-card .brand { color: var(--navy); margin-bottom: 26px; }
.login-card .brand span { color: var(--blue); }
.login-card h1 { font-size: 24px; }
.login-card p { color: var(--text); margin: 8px 0 18px; }
.login-card input { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.login-card .btn { width: 100%; }
.login-msg { margin-top: 14px; color: var(--text); font-size: 13.5px; }

/* topo */
.top { background: var(--navy); color: #fff; display: flex; align-items: flex-end; gap: 24px; padding: 14px 24px; flex-wrap: wrap; }
.top .brand { align-self: center; }
.top-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; flex: 1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ice); }
.field select, .field input { background: var(--navy2); border: 1px solid #2c5a70; color: #fff; border-radius: 7px; padding: 8px 10px; min-width: 0; }
#accSel { min-width: 230px; max-width: 320px; }
.field .row { display: flex; gap: 6px; }
.field input[type=date] { color-scheme: dark; }
.check { display: flex; gap: 7px; align-items: center; font-size: 13px; color: #C8D5DD; padding-bottom: 8px; cursor: pointer; }
.top-right { display: flex; gap: 16px; align-items: center; margin-left: auto; padding-bottom: 8px; }
.updated { font-size: 12px; color: #A9BBC6; }
.link { color: #fff; font-weight: 600; text-decoration: none; font-size: 13px; }

/* filtros */
.filters { display: flex; gap: 10px; align-items: center; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.search { border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 220px; }
.period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-left: 12px; border-left: 1.5px solid var(--line); }
.period .plabel { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.period select, .period input[type=date] { border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); }
.period input[type=date] { color-scheme: light; }
.period .ate { color: var(--mute); font-size: 13px; }
.filters .check { color: var(--text); padding-bottom: 0; }
.ms { position: relative; }
.ms > button { border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; cursor: pointer; display: flex; gap: 8px; align-items: center; max-width: 320px; }
.ms > button b { font-weight: 700; }
.ms > button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ms .drop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,48,63,.15); width: min(440px, 92vw); padding: 10px; }
.ms .drop > input { width: 100%; border: 1.5px solid var(--line); border-radius: 7px; padding: 7px 10px; margin-bottom: 8px; }
.ms .opts { max-height: 300px; overflow: auto; }
.ms .opt { display: flex; gap: 10px; align-items: flex-start; padding: 7px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; text-align: left; line-height: 1.35; }
.ms .opt input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--blue); cursor: pointer; }
.ms .opt span { flex: 1; min-width: 0; word-break: break-word; }
.ms .opt:hover { background: var(--bg); }
.ms .opt small { color: var(--mute); display: block; }
.ms .acts { display: flex; justify-content: space-between; margin-top: 8px; }

.btn { border: 0; border-radius: 8px; padding: 11px 18px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.link { background: none; color: var(--blue); padding: 4px 6px; }

.wrap { padding: 20px 24px 40px; max-width: 1500px; margin: 0 auto; }
.loading { background: #fff; border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; color: var(--text); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: 10px; padding: 14px 16px; border: 1px solid var(--line); }
.kpi .l { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--mute); }
.kpi .v { font-size: 22px; font-weight: 800; margin-top: 6px; white-space: nowrap; }
.kpi .d { font-size: 12.5px; font-weight: 700; margin-top: 4px; }
.kpi .d.up { color: var(--up); } .kpi .d.down { color: var(--down); } .kpi .d.flat { color: var(--mute); }
.kpi .d small { color: var(--mute); font-weight: 500; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-top: 16px; padding: 16px 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel h2 { font-size: 16px; }
.chart-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-ctl select { border: 1.5px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #fff; }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--navy); color: #fff; }
.chart-box { position: relative; height: 300px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font-weight: 700; color: var(--mute); cursor: pointer; }
.tabs button.on { background: var(--bg); color: var(--navy); }

/* Tabela rola dentro da caixa (altura da tela): a barra lateral fica sempre à vista,
   cabeçalho, total e coluna do nome ficam fixos. Sombra à direita quando há mais colunas. */
.table-outer { position: relative; }
.table-wrap { overflow: auto; max-height: 72vh; }
.table-outer::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 36px; pointer-events: none; background: linear-gradient(to right, rgba(255,255,255,0), rgba(20,48,63,.13)); border-radius: 0 6px 6px 0; opacity: 0; transition: opacity .2s; }
.table-outer.more::after { opacity: 1; }
#table thead th { position: sticky; top: 0; background: #fff; z-index: 2; }
#table td:first-child, #table th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
#table thead th:first-child { z-index: 3; }
#table tr.total td { position: sticky; bottom: 0; z-index: 1; }
#table tr.total td:first-child { z-index: 3; }
.table-outer.scrolled #table td:first-child, .table-outer.scrolled #table th:first-child { box-shadow: 6px 0 8px -6px rgba(20,48,63,.25); }
.more-cols { display: none; font-size: 12px; color: var(--mute); margin: 0 0 6px; text-align: right; }
.more-cols.on { display: block; }
@media (max-width: 720px) { #table td:first-child { min-width: 150px; } .table-wrap { max-height: 65vh; } }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: right; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--mute); padding: 9px 10px; border-bottom: 1.5px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
th:first-child, td:first-child { text-align: left; }
th.sorted { color: var(--navy); }
td { text-align: right; padding: 9px 10px; border-bottom: 1px solid #EEF2F5; white-space: nowrap; font-variant-numeric: tabular-nums; }
td:first-child { white-space: normal; min-width: 240px; max-width: 460px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #F7FAFC; }
tr.sel td { background: #EAF3F9; }
tr.total td { font-weight: 800; border-top: 1.5px solid var(--line); background: #FAFBFC; }
.name small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 2px; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }
.pill.on { background: #DDF3E5; color: #17803f; } .pill.off { background: #EEF1F4; color: var(--mute); }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; float: left; margin-right: 12px; background: var(--bg); position: relative; transition: transform .15s ease, box-shadow .15s ease; transform-origin: left center; }
.thumb-link { display: block; flex: none; }
.adcell { display: flex; gap: 12px; align-items: flex-start; }
.adcell .thumb { float: none; margin: 0; flex: none; }
.adtxt { min-width: 0; }
#hoverPrev { position: fixed; z-index: 50; width: 280px; height: 280px; object-fit: contain; background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(20,48,63,.35); pointer-events: none; display: none; }
.pv { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--blue); text-decoration: none; }
.pv:hover { text-decoration: underline; }
.share { display: inline-block; height: 8px; background: var(--sky); border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.hint { color: var(--mute); font-size: 12px; margin-top: 10px; }

@media (max-width: 720px) {
  .top { padding: 12px 16px; gap: 12px; }
  .top-controls { gap: 10px; }
  #accSel { min-width: 0; width: 100%; max-width: none; }
  .top-controls .field { flex: 1 1 100%; }
  .top-right { margin-left: 0; }
  .filters { padding: 10px 16px; position: static; }
  .search { min-width: 0; flex: 1 1 100%; }
  .period { padding-left: 0; border-left: 0; flex: 1 1 100%; }
  .period select { flex: 1 1 100%; }
  .period input[type=date] { flex: 1 1 0; min-width: 0; }
  .wrap { padding: 14px 16px 30px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .v { font-size: 18px; }
  .chart-box { height: 240px; }
}

/* ---------- botão Simples / Completa ---------- */
.view-seg { border-color: #2c5a70; align-self: center; }
.view-seg button { background: var(--navy2); color: #C8D5DD; padding: 7px 14px; }
.view-seg button.on { background: #fff; color: var(--navy); }

/* ---------- visão Simples ---------- */
.basic { display: block; }
.bhead h1 { font-size: 26px; font-weight: 800; }
.bhead p { color: var(--text); margin-top: 4px; font-size: 14.5px; }
.bcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.bcard .v { font-size: 30px; }
.bcard .v small { font-size: 14px; font-weight: 600; color: var(--mute); }
.bcard .d { font-size: 13px; margin-top: 6px; }
.bcard.main { border-color: var(--blue); box-shadow: inset 4px 0 0 var(--blue); }
.bcard.muted .v { color: var(--mute); font-size: 22px; }
.kpi .d.good { color: var(--up); } .kpi .d.bad { color: var(--down); }
.bsum { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-top: 14px; font-size: 15px; line-height: 1.6; color: var(--ink); }
.bpanel h2 { font-size: 16px; }
.bchart { height: 280px; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(140px, 260px) 1fr minmax(170px, auto); gap: 12px; align-items: center; font-size: 13.5px; }
.hname { font-weight: 600; }
.htrack { height: 14px; background: var(--pale); border-radius: 7px; overflow: hidden; }
.hfill { height: 100%; background: var(--blue); border-radius: 7px; }
.hval { color: var(--text); white-space: nowrap; }
.bwins { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.bwin .l { margin-bottom: 6px; }
.bwin.creative { display: flex; gap: 14px; align-items: flex-start; }
.bwin.creative img, .bwin.creative > span { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; background: var(--bg); display: block; }
.wname { font-weight: 700; font-size: 14px; }
.wquote { font-weight: 700; font-size: 15px; margin: 2px 0 6px; }
.wtxt { font-size: 13px; color: var(--text); margin-top: 4px; line-height: 1.45; }
.witem { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 5px 0; border-bottom: 1px solid #EEF2F5; }
.witem:last-child { border-bottom: 0; }
.bnote { color: var(--text); font-size: 14px; }
.bfoot { color: var(--mute); font-size: 12.5px; margin-top: 14px; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 18px; }
.ov-card { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; font: inherit; }
.ov-card:hover { border-color: var(--blue); box-shadow: 0 4px 16px rgba(20,48,63,.08); }
.ov-name { font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.ov-name small { display: block; font-weight: 500; color: var(--mute); font-size: 12px; margin-top: 2px; }
.ov-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; color: var(--text); }
.ov-row b { color: var(--ink); }
@media (max-width: 720px) {
  .view-seg { order: 3; }
  .bhead h1 { font-size: 21px; }
  .bcards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .bcard .v { font-size: 21px; }
  .hbar { grid-template-columns: 1fr; gap: 4px; }
  .hval { white-space: normal; }
  .bchart { height: 230px; }
}

/* ajustes de celular da visão Simples e do período */
.bcard .v { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .bcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bcard { padding: 12px 12px; }
  .bcard .v { font-size: 19px; }
  .bcard.muted .v { font-size: 17px; }
  .bcard .d { font-size: 12px; }
  .period .check { flex: 1 1 100%; }
  .period input[type=date] { flex: 1 1 120px; min-width: 120px; }
}

/* seletor de imóvel */
.propsel { display: flex; gap: 8px; align-items: center; }
.propsel .plabel { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--mute); }
.propsel select { border: 1.5px solid var(--blue); border-radius: 8px; padding: 7px 10px; background: #fff; font-weight: 600; }
@media (max-width: 720px) { .propsel { flex: 1 1 100%; } .propsel select { flex: 1; } }
.bprop { display: inline-block; margin-top: 6px; background: var(--blue); color: #fff; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 20px; }

/* ---------- layout de relatório (igual ao PDF da campanha) ---------- */
.rep { font-family: "Segoe UI", Arial, sans-serif; color: #2b2b2b; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #e3e3e3; max-width: 1000px; margin: 0 auto; }
.rep-h { background: #1f2a30; color: #fff; padding: 30px 44px 24px; }
.rep-brand { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: #c9a86a; font-weight: 600; }
.rep-h h1 { font-size: 30px; font-weight: 600; margin-top: 12px; }
.rep-sub { font-size: 14.5px; color: #cfd6d9; margin-top: 8px; line-height: 1.55; }
.rep-main { padding: 22px 44px 10px; }
.rep-hero { background: #f6f1e6; border-left: 5px solid #c9a86a; padding: 18px 26px; display: flex; align-items: center; gap: 26px; }
.rep-hero .num { font-size: 52px; font-weight: 700; color: #1f2a30; line-height: 1; }
.rep-hero .t { font-size: 19px; font-weight: 600; color: #1f2a30; }
.rep-hero .d { font-size: 14px; color: #555; margin-top: 6px; line-height: 1.5; }
.rep h2 { font-size: 14.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: #1f2a30; margin: 26px 0 12px; border-bottom: 1px solid #e3e3e3; padding-bottom: 8px; }
.rep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rep-card { border: 1px solid #e3e3e3; border-radius: 4px; padding: 14px 18px 12px; }
.rep-card .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: #8a6d2f; font-weight: 600; }
.rep-card .value { font-size: 25px; font-weight: 700; color: #1f2a30; margin: 6px 0 6px; }
.rep-card .exp { font-size: 12.5px; color: #5a5a5a; line-height: 1.45; margin-top: 4px; }
.rep-d { font-size: 12px; font-weight: 600; color: #8a8a8a; }
.rep-d.good { color: #1d7a3e; } .rep-d.bad { color: #b42318; }
.rep-funnel { display: flex; align-items: stretch; gap: 10px; }
.rep-funnel .step { flex: 1; background: #1f2a30; color: #fff; border-radius: 4px; padding: 14px 10px; text-align: center; }
.rep-funnel .step:nth-child(3) { background: #36474f; }
.rep-funnel .step:nth-child(5) { background: #4a5d66; }
.rep-funnel .step.gold { background: #c9a86a; color: #1f2a30; }
.rep-funnel .step b { display: block; font-size: 24px; }
.rep-funnel .step span { font-size: 12.5px; }
.rep-funnel .arrow { display: flex; align-items: center; color: #9a9a9a; font-size: 20px; }
.rep-t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rep-t th { background: #1f2a30; color: #fff; font-weight: 600; text-align: center; padding: 10px; font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.rep-t td { text-align: center; padding: 11px 10px; border-bottom: 1px solid #e3e3e3; font-weight: 600; color: #1f2a30; white-space: nowrap; }
.rep-t td:first-child { text-align: left; font-weight: 700; white-space: normal; min-width: 0; }
.rep-t tr.tot td { background: #f6f1e6; }
.rep-t td.bom { color: #1d7a3e; }
.rep-t tr.click { cursor: pointer; }
.rep-t tr.click:hover td { background: #faf7f0; }
.rep-txt { font-size: 13px; line-height: 1.55; color: #555; margin-top: 8px; }
.rep-chart { position: relative; height: 260px; }
.rep-wins { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.rep-win { display: flex; gap: 14px; border: 1px solid #e3e3e3; border-left: 4px solid #c9a86a; border-radius: 4px; padding: 12px; }
.rep-win img, .rep-win > span { width: 90px; height: 90px; object-fit: cover; border-radius: 4px; flex: none; background: #f6f1e6; display: block; }
.rep-win b { display: block; color: #1f2a30; font-size: 14px; }
.rep-win span { display: block; font-size: 12.5px; color: #555; margin-top: 4px; line-height: 1.45; }
.rep-win .pv { color: #8a6d2f; }
.rep-f { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #8a8a8a; border-top: 1px solid #e3e3e3; margin: 20px 44px 0; padding: 12px 0 18px; }
@media (max-width: 720px) {
  .rep-h { padding: 22px 18px 18px; }
  .rep-h h1 { font-size: 23px; }
  .rep-main { padding: 16px 16px 6px; }
  .rep-hero { padding: 14px 16px; gap: 14px; }
  .rep-hero .num { font-size: 40px; }
  .rep-grid { grid-template-columns: 1fr 1fr; }
  .rep-card .value { font-size: 20px; }
  .rep-funnel { flex-direction: column; }
  .rep-funnel .arrow { justify-content: center; transform: rotate(90deg); height: 14px; }
  .rep-t { font-size: 12px; display: block; overflow-x: auto; }
  .rep-f { margin: 14px 16px 0; }
}
@media (max-width: 720px) { .top-controls { flex: 1 1 100%; } }
.rep-actions { max-width: 1000px; margin: 0 auto 10px; display: flex; justify-content: flex-end; }
.rep-actions .btn { background: #1f2a30; color: #fff; }
.rep-actions .btn:hover { background: #c9a86a; color: #1f2a30; }

/* marca white label e logo do cliente */
#topBrand { display: flex; align-items: center; gap: 14px; }
.brand .wl-logo { height: 20px; width: auto; display: block; }
.brand .client-logo { height: 30px; width: auto; display: block; border-radius: 3px; }
.bclient { display: block; height: 46px; width: auto; border-radius: 4px; margin-bottom: 12px; }
@media (max-width: 720px) { .brand .client-logo { height: 24px; } .bclient { height: 36px; } }
.brand .b369 { color: #fff; font-size: 20px; font-weight: 800; }
#topBrand { cursor: pointer; } #topBrand:hover { opacity: .85; } #topBrand:focus-visible { outline: 2px solid #8EC5E2; outline-offset: 4px; border-radius: 4px; }
