/* Painel de anúncios — LCA Corretora de Seguros
   Mesma identidade do calendário de conteúdo (painel-social):
   preto azulado #101820, azul #174A78, ciano #00D1FF, verde limão. Montserrat. */

:root {
  --ink: #101820;
  --ink-2: #16222d;
  --ink-3: #1d2b38;
  --navy: #174a78;
  --cyan: #00d1ff;
  --cyan-ink: #0079a8;
  --lime: #bdec8f;
  --lime-ink: #3d7a14;
  --grad: linear-gradient(90deg, #00b7ee 0%, #00cfc9 48%, #d0e638 100%);

  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #dbe2ea;
  --line-2: #e8edf2;
  --text: #101820;
  --muted: #5a6a7c;
  --muted-2: #8594a5;

  --ok: #2f8a3c;
  --ok-bg: #e9f7e2;
  --warn: #b26a00;
  --warn-bg: #fff2dc;
  --info: #0b6f9c;
  --info-bg: #e0f6fd;
  --danger: #b3261e;
  --danger-bg: #fdecea;

  --r: 6px;
  --r-lg: 10px;
  --shadow: 0 18px 50px rgba(16, 24, 32, .12);
  --shadow-sm: 0 2px 10px rgba(16, 24, 32, .06);
  --font: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg); min-height: 100vh;
  display: flex; flex-direction: column;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--cyan-ink); }
.eyebrow--light { color: var(--cyan); }
.accent-line { height: 3px; background: var(--grad); }
.num, .tab { font-variant-numeric: tabular-nums; }

/* ---------- topo ---------- */
.top { background: var(--ink); color: #fff; }
.top__in { display: flex; align-items: center; gap: 28px; min-height: 92px; }
.brand img { height: 58px; width: auto; }
.top__title { display: flex; flex-direction: column; gap: 2px; padding-left: 28px; border-left: 1px solid rgba(255,255,255,.14); }
.top__title[hidden] { display: none; }
.top__title strong { font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.monthnav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.monthnav select {
  appearance: none;
  background: var(--ink-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300d1ff' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: var(--r);
  padding: 10px 40px 10px 16px; font-weight: 600; font-size: 15px; min-width: 230px;
}
.monthnav select:hover { border-color: var(--cyan); }
.monthnav select option, .monthnav select optgroup { color: var(--text); background: #fff; }

/* ---------- barra de visão ---------- */
.viewbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.viewbar__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.viewbar__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 18px; border-radius: 4px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--ink); color: #fff; }
.syncinfo { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.syncinfo svg { width: 14px; height: 14px; }
.syncinfo--err { color: var(--danger); font-weight: 600; }
.admintools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admintag { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); background: var(--lime); padding: 5px 10px; border-radius: 3px; }
.banner { background: var(--warn-bg); color: #7a4a00; font-size: 13.5px; padding: 10px 0; border-bottom: 1px solid #f1d9ad; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--navy); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--navy); border-color: var(--navy); }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn--lg { min-height: 50px; padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.is-busy svg { animation: spin .8s linear infinite; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.linkbtn:hover { color: var(--text); }

/* ---------- conteúdo ---------- */
main.wrap { flex: 1; padding-top: 32px; padding-bottom: 48px; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.intro h1 { margin: 6px 0 4px; font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.intro p { margin: 0; color: var(--muted); max-width: 640px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 12px; flex-wrap: wrap; }
.section-h h2 { margin: 0; font-size: 20px; font-weight: 700; }
.section-h p { margin: 0; color: var(--muted); font-size: 13.5px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; overflow: hidden; }
.kpi { padding: 20px 22px 18px; border-left: 1px solid var(--line-2); position: relative; }
.kpi:first-child { border-left: 0; }
.kpi dt { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi dd { margin: 6px 0 0; }
.kpi__v { display: block; font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi__sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi--hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta svg { width: 12px; height: 12px; }
.delta--good { color: var(--ok); }
.delta--bad { color: var(--danger); }
.delta--flat { color: var(--muted); }

.minis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 12px; overflow: hidden; }
.mini { padding: 12px 16px; border-left: 1px solid var(--line-2); }
.mini:first-child { border-left: 0; }
.mini dt { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mini dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

/* gráficos */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart { padding: 18px 20px 12px; position: relative; }
.chart h3 { margin: 0; font-size: 15px; font-weight: 700; }
.chart__sub { margin: 2px 0 10px; font-size: 12.5px; color: var(--muted); }
.chart__plot { position: relative; height: 230px; }
.chart__plot svg { display: block; overflow: visible; touch-action: pan-y; }
.chart__plot .grid line { stroke: var(--line-2); stroke-width: 1; }
.chart__plot .grid line.base { stroke: var(--line); }
.chart__plot text { font-size: 11px; fill: var(--muted); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart__plot .bar { fill: var(--navy); }
.chart__plot .bar--partial { fill: #8fa9c2; }
.chart__plot .band { fill: rgba(23, 74, 120, .07); }
.tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 168px;
  background: var(--ink); color: #fff; border-radius: var(--r); padding: 10px 12px; font-size: 12.5px;
  box-shadow: var(--shadow); transform: translate(-50%, calc(-100% - 10px));
}
.tip b { display: block; font-size: 12px; color: var(--cyan); margin-bottom: 4px; font-weight: 700; }
.tip div { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip span { color: #b9c6d3; }
.tablelink { margin-top: 6px; }
.tablelink summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.tablelink table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.tablelink th, .tablelink td { padding: 4px 6px; border-bottom: 1px solid var(--line-2); text-align: right; font-variant-numeric: tabular-nums; }
.tablelink th:first-child, .tablelink td:first-child { text-align: left; }

/* leitura do período */
.strategy { background: var(--ink); color: #e9eef3; border-radius: var(--r-lg); padding: 26px 30px 28px; position: relative; overflow: hidden; }
.strategy::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); }
.strategy h2 { margin: 6px 0 16px; font-size: 22px; color: #fff; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.alert { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 14px 16px; border-radius: var(--r); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.alert__ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.alert__ic svg { width: 15px; height: 15px; }
.alert--red .alert__ic { background: #ff6b5e; color: var(--ink); }
.alert--yellow .alert__ic { background: #ffc35c; color: var(--ink); }
.alert--green .alert__ic { background: var(--lime); color: var(--ink); }
.alert--info .alert__ic { background: var(--cyan); color: var(--ink); }
.alert__lvl { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9fb0c0; }
.alert b { display: block; color: #fff; font-size: 14.5px; margin: 1px 0 3px; }
.alert p { margin: 0; color: #c7d2dd; font-size: 13.5px; }

/* funil */
.funnel { padding: 22px 24px; }
.frow { display: grid; grid-template-columns: 210px 1fr 150px; gap: 16px; align-items: center; padding: 7px 0; }
.frow__label { font-size: 13.5px; font-weight: 600; }
.frow__label small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.frow__track { height: 26px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.frow__bar { height: 100%; background: var(--navy); border-radius: 0 4px 4px 0; min-width: 3px; }
.frow--manual .frow__bar { background: var(--cyan-ink); }
.frow__val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.frow__val small { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.frow__empty { font-size: 12.5px; color: var(--muted-2); font-style: italic; }
.funnel__note { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }

/* tabelas */
.overview { overflow-x: auto; }
.overview table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 920px; }
.overview th { text-align: right; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.overview th:first-child, .overview td:first-child { text-align: left; }
.overview td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview tr:last-child td { border-bottom: 0; }
.overview .name { white-space: normal; min-width: 260px; }
.overview .name b { font-weight: 700; }
.overview tr.lv-campaign td { background: #fbfcfd; }
.overview tr.lv-adset .name { padding-left: 34px; }
.overview tr.lv-ad .name { padding-left: 58px; }
.overview .lvl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan-ink); }
.overview .muted { color: var(--muted-2); }
.overview tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
.adname { display: flex; gap: 10px; align-items: center; }
.thumb { width: 36px; height: 45px; border-radius: 4px; overflow: hidden; flex: none; background: var(--ink-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.week-input { width: 74px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.week-input:focus { outline: none; border-color: var(--cyan-ink); box-shadow: 0 0 0 3px rgba(0, 209, 255, .18); }
.note-input { width: 100%; min-width: 180px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; }

/* status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status--ok { color: var(--ok); }
.status--info { color: var(--info); }
.status--warn { color: var(--warn); }
.status--danger { color: var(--danger); }
.status--muted { color: var(--muted-2); }

/* criativos */
.creatives { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.creative { overflow: hidden; display: flex; flex-direction: column; }
.creative__media { position: relative; aspect-ratio: 4 / 5; max-height: 300px; background: var(--ink-2); overflow: hidden; }
.creative__media img { width: 100%; height: 100%; object-fit: cover; }
.creative__tag { position: absolute; left: 10px; top: 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 3px; background: var(--lime); color: var(--ink); }
.creative__tag--bad { background: #ffd9d4; color: #7c1a14; }
.creative__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.creative__body h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.creative__where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line-2); }
.cstats dt { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cstats dd { margin: 1px 0 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.share { font-size: 12px; color: var(--muted); }
.share__track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.share__track i { display: block; height: 100%; background: var(--navy); border-radius: 0 3px 3px 0; }
.placeholder { position: relative; width: 100%; height: 100%; display: grid; place-items: center; background: radial-gradient(120% 90% at 20% 0%, #1d3a59 0%, var(--ink) 70%); color: rgba(255,255,255,.55); }
.placeholder svg { width: 30px; height: 30px; }
.placeholder::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); opacity: .8; }

/* ---------- estados ---------- */
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 56px 24px; text-align: center; color: var(--muted); }
.empty h2 { margin: 0 0 6px; color: var(--text); font-size: 20px; }
.empty p { margin: 0 auto 18px; max-width: 520px; }
.empty ol { text-align: left; max-width: 560px; margin: 0 auto 18px; color: var(--text); font-size: 14px; }
.empty code { background: var(--surface-2); border: 1px solid var(--line-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
.loading::before { content: ''; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--cyan-ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- drawer / modal ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(16,24,32,.55); animation: fade .2s ease; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slide .25s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer__body { overflow-y: auto; flex: 1; }
.modal { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { margin: 0; font-size: 20px; }
.modal p { margin: 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.field input { width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 10px 12px; font-size: 14px; }
.field input:focus { outline: none; border-color: var(--cyan-ink); box-shadow: 0 0 0 3px rgba(0, 209, 255, .18); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r); box-shadow: var(--shadow); font-size: 14px; font-weight: 500; max-width: calc(100% - 32px); }
.toast--err { background: var(--danger); }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 20px; padding-bottom: 28px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- responsivo ---------- */
@media (max-width: 1080px) {
  .top__title { display: none; }
  .minis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mini:nth-child(4) { border-left: 0; }
  .mini:nth-child(n+4) { border-top: 1px solid var(--line-2); }
}
@media (max-width: 860px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .kpi__v { font-size: 24px; }
  .charts { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 1fr 110px; }
  .frow__track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top__in { min-height: 72px; gap: 12px; }
  .brand img { height: 42px; }
  .monthnav select { min-width: 0; width: 196px; padding: 9px 30px 9px 12px; font-size: 13.5px; background-position: right 10px center; }
  .intro h1 { font-size: 24px; }
  .minis { grid-template-columns: 1fr 1fr; }
  .mini:nth-child(odd) { border-left: 0; }
  .mini:nth-child(4) { border-left: 1px solid var(--line-2); }
  .mini:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .strategy { padding: 22px 18px; }
  .alerts { grid-template-columns: 1fr; }
  .seg button { padding: 8px 12px; font-size: 13px; }
  .viewbar { position: static; }
  .funnel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- troca de painel (calendário | anúncios) ---------- */
.apps { display: flex; gap: 6px; padding-left: 24px; border-left: 1px solid rgba(255,255,255,.14); }
.apps[hidden] { display: none; }
.apps a { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; border-radius: var(--r-lg, 10px); color: rgba(255,255,255,.58); text-decoration: none; transition: background .15s, color .15s; }
.apps a strong { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.apps a .eyebrow { color: rgba(0,209,255,.55); }
.apps a:hover { color: #fff; background: rgba(255,255,255,.05); }
.apps a[aria-current="page"] { color: #fff; background: var(--ink-3); box-shadow: inset 0 -2px 0 var(--lime); }
.apps a[aria-current="page"] .eyebrow { color: var(--cyan); }
.apps a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 1080px) { .apps a .eyebrow { display: none; } .apps a { justify-content: center; } }
@media (max-width: 640px) {
  .top__in:has(.apps:not([hidden])) { flex-wrap: wrap; row-gap: 0; padding-top: 10px; }
  .apps { order: 3; width: 100%; padding: 8px 0 10px; border-left: 0; gap: 4px; }
  .apps a { flex: 1; align-items: center; padding: 9px 10px; min-height: 44px; }
  .apps a strong { font-size: 14.5px; }
}
