/* Painel Wiggle — visual grafite, preto e branco, Inter */
:root {
  --bg: #1f2226; --side: #181a1d; --surface: #2a2e33; --surface2: #32373d; --black: #141619;
  --ink: #f5f6f7; --muted: #a2a8b0; --line: #3c4249; --accent: #f5f6f7; --accent-ink: #111214;
  --ok: #7fd3a0; --ok-soft: #263a2f; --warn: #e8b455; --warn-soft: #3d3524; --bad: #f09089; --bad-soft: #40292a;
  --info: #8fb8f0; --info-soft: #26324a; --done: #aab0b8; --done-soft: #393e45;
  --ig: #e1306c; --fb: #4c8df6;
  --r: 14px; --r-lg: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 16px; margin-bottom: 14px; }
a { color: var(--info); }
.muted { color: var(--muted); font-size: 13px; }
.small-text { font-size: 12px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
/* Marca Bati a Meta! */
.brand-icon { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand-name { font-weight: 600; color: var(--muted); font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-name b { color: var(--ink); font-weight: 900; font-size: 18px; letter-spacing: -.03em; }
.brand-name i { color: #C8F135; font-style: normal; }
.login-brand { padding: 0 0 8px; }
.login-brand .brand-icon { width: 44px; height: 44px; border-radius: 12px; }
.login-brand .brand-name { font-size: 18px; } .login-brand .brand-name b { font-size: 24px; }
:root { --brand-accent: #C8F135; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; }
#nav button { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: 0; color: var(--muted); padding: 9px 10px; border-radius: 10px; font-weight: 500; text-align: left; min-height: 0; }
#nav button:hover { background: var(--surface); color: var(--ink); }
#nav button.active { background: var(--surface2); color: var(--ink); }
.ico { width: 18px; text-align: center; opacity: .8; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 14px 6px 0; }
.me-name { font-weight: 600; font-size: 14px; }
.main { padding: 36px 40px 96px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.sub { color: var(--muted); margin: 6px 0 0; }
.tab { display: none; } .tab.active { display: block; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between, .between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 10px; }
  #nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; order: 3; flex: 1 1 100%; width: 100%; scrollbar-width: none; }
  #nav::-webkit-scrollbar { display: none; }
  .side .brand-name { display: none; }
  .me #meRole { display: none; }
  .nav-group { display: none; }
  #nav button { white-space: nowrap; width: auto; }
  .me { border: 0; padding: 0; margin-left: auto; }
  .main { padding: 24px 16px 80px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* ---------- controles ---------- */
button { font: inherit; cursor: pointer; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; min-height: 40px; font-weight: 500; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); }
button.small { padding: 5px 12px; min-height: 32px; font-size: 13px; }
.icon-btn { width: 38px; padding: 0; display: grid; place-items: center; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--black); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--muted); outline: none; }
textarea { resize: vertical; line-height: 1.6; }
select { cursor: pointer; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.field-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.bad-text { color: var(--bad); font-size: 14px; margin: 0; }
.upload { display: inline-flex; cursor: pointer; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 16px; color: var(--muted); }
.upload:hover { border-color: var(--muted); color: var(--ink); }
.upload input { display: none; }

/* ---------- blocos ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 22px; margin-bottom: 20px; }
.form { display: grid; gap: 12px; max-width: 760px; }
.form h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.card .table-wrap { background: transparent; }
code { background: var(--black); padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--accent-ink); padding: 11px 18px; border-radius: 12px; z-index: 50; max-width: 90vw; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ---------- indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { min-width: 0; } .kpi .v { overflow-wrap: anywhere; }
.kpi, .stat { background: var(--surface); border-radius: var(--r); padding: 16px 18px; }
.kpi .l, .stat { color: var(--muted); font-size: 13px; }
.kpi .v { font-size: clamp(20px, 1.9vw, 26px); font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--ok); margin-top: 2px; }
.stat b { display: block; color: var(--ink); font-size: 22px; font-weight: 600; margin-top: 2px; }
.stats { display: contents; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.rep-grid .card { margin-bottom: 0; }
.rep-grid + .card { margin-top: 20px; }
.fstep { margin-bottom: 14px; } .fstep .row { justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.fbar { height: 10px; background: var(--black); border-radius: 99px; overflow: hidden; } .fbar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-top: 10px; }
.bars .b { flex: 1; min-width: 12px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bars .b .t { width: 100%; background: var(--surface2) !important; border-radius: 5px 5px 0 0; position: relative; min-height: 2px; }
.bars .b .t[style*="var(--brand)"] { background: var(--ink) !important; }
.bars .b .q { position: absolute; bottom: 0; left: 0; right: 0; background: var(--ink); border-radius: 5px 5px 0 0; }
.bars .b small { font-size: 9px; color: var(--muted); margin-top: 4px; white-space: nowrap; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--side); border-radius: var(--r-lg); padding: 12px; min-height: 62vh; }
.col.over { outline: 2px dashed var(--muted); }
.col h4 { margin: 4px 4px 12px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.lead { background: var(--surface); border-radius: var(--r); padding: 12px; margin-bottom: 10px; cursor: pointer; border: 1px solid transparent; transition: border-color .15s; }
.lead:hover { border-color: var(--line); }
.lead .top { display: flex; justify-content: space-between; gap: 6px; }
.lead .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.lead .thumb { width: 100%; height: 96px; object-fit: cover; border-radius: 10px; margin-top: 8px; background: var(--black); }
.unread { background: var(--ok); color: var(--accent-ink); border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; }
.tag { display: inline-block; font-size: 11px; background: var(--surface2); color: var(--ink); border-radius: 6px; padding: 1px 7px; margin: 6px 4px 0 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface2); }
.badge.open { background: var(--ok-soft); color: var(--ok); } .badge.close { background: var(--bad-soft); color: var(--bad); } .badge.connecting { background: var(--warn-soft); color: var(--warn); }
.qr { width: 100%; max-width: 240px; display: block; margin: 12px auto; border-radius: 12px; background: #fff; padding: 8px; }

/* ---------- painel lateral do lead ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--side); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; box-shadow: -20px 0 40px rgba(0,0,0,.35); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dinfo { padding: 12px 18px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.dinfo hr { border: 0; border-top: 1px solid var(--line); }
.dad { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dad img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: var(--black); }
.dad .t { font-weight: 600; font-size: 14px; } .dad .b { font-size: 12px; color: var(--muted); max-height: 54px; overflow: hidden; }
.qualify { display: flex; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.qualify button { flex: 1; font-size: 13px; padding: 8px 10px; }
.qualify .ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.qualify .bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.qualify .buy { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface); white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.msg.me { align-self: flex-end; background: var(--surface2); border-radius: 14px 14px 4px 14px; }
.msg small { display: block; color: var(--muted); font-size: 10px; text-align: right; margin-top: 2px; }
.send { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.send input { flex: 1; }

/* ---------- criativos ---------- */
.creatives { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cr { background: var(--side); border-radius: var(--r); overflow: hidden; }
.cr img, .cr .noimg { width: 100%; height: 160px; object-fit: cover; display: block; background: var(--black); }
.cr .noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.cr .in { padding: 12px; } .cr .tt { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.cr .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; text-align: center; font-size: 11px; color: var(--muted); }
.cr .nums b { display: block; font-size: 18px; color: var(--ink); font-weight: 600; }
.rate { font-size: 12px; margin-top: 8px; color: var(--muted); } .rate b { color: var(--ok); }
.bal .v { font-size: 22px; font-weight: 600; margin: 4px 0; } .bal { margin-bottom: 0; }
.bal.low { box-shadow: inset 0 0 0 1px var(--bad); } .bal.low .v { color: var(--bad); }

/* ---------- status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 999px; background: var(--surface2); color: var(--muted); font-style: normal; }
.pill.aguardando { background: var(--warn-soft); color: var(--warn); }
.pill.ajuste, .pill.erro { background: var(--bad-soft); color: var(--bad); }
.pill.aprovado { background: var(--ok-soft); color: var(--ok); }
.pill.publicando { background: var(--info-soft); color: var(--info); }
.pill.publicado { background: var(--done-soft); color: var(--done); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.criacao { background: #6b737c; } .dot.aguardando { background: var(--warn); } .dot.ajuste, .dot.erro { background: var(--bad); }
.dot.aprovado { background: var(--ok); } .dot.publicado { background: var(--done); } .dot.publicando { background: var(--info); }
.dot.ig { background: var(--ig); } .dot.fb { background: var(--fb); }

/* ---------- aprovação ---------- */
.status-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 28px; }
.status-tabs button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 18px; border: 0; border-radius: var(--r); background: var(--surface); min-height: 0; text-align: left; }
.status-tabs button .n { font-size: 26px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.status-tabs button .l { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.status-tabs button[aria-pressed="true"] { background: var(--surface2); box-shadow: inset 0 0 0 2px var(--ink); }
.ap-list { display: flex; flex-direction: column; gap: 24px; }
.ap-card { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 32px; background: var(--surface); border-radius: var(--r-lg); padding: 24px; }
@media (max-width: 760px) { .ap-card { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px; } }
.ap-media { min-width: 0; }
.scroller { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 12px; background: var(--black); aspect-ratio: 4/5; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller img, .scroller video { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.cnav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.nomedia { aspect-ratio: 4/5; display: grid; place-items: center; border-radius: 12px; background: var(--black); color: var(--muted); font-size: 13px; }
.ap-body { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ap-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 2px 9px; display: inline-flex; align-items: center; gap: 6px; }
.ap-when { font-size: 13px; color: var(--muted); }
.ap-title { font-size: 19px; font-weight: 600; }
.ap-caption { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; max-width: 68ch; line-height: 1.65; color: #dfe2e5; }
.quote { border-left: 3px solid var(--bad); background: var(--bad-soft); padding: 12px 14px; border-radius: 0 10px 10px 0; white-space: pre-wrap; font-size: 14px; }
.quote b { display: block; font-size: 12px; margin-bottom: 4px; color: var(--bad); }
.ap-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: auto; }
.ap-actions .approve { background: var(--ok); color: var(--accent-ink); border-color: var(--ok); font-weight: 600; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 56px 16px; border: 1px dashed var(--line); border-radius: var(--r-lg); }
.review-note { border-left: 3px solid var(--bad); background: var(--bad-soft); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 14px; white-space: pre-wrap; }

/* ---------- calendário ---------- */
.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.cal-title { min-width: 160px; text-align: center; text-transform: capitalize; font-size: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal .h { font-size: 12px; color: var(--muted); text-align: center; padding: 4px; text-transform: uppercase; letter-spacing: .05em; }
.cal .d { background: var(--surface); border-radius: var(--r); min-height: 124px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 2px solid transparent; }
.cal .d:hover { background: var(--surface2); }
.cal .d.out { opacity: .4; } .cal .d.today { border-color: var(--ink); }
.cal .n { font-size: 13px; font-weight: 600; color: var(--muted); }
.cal .it { display: flex; gap: 6px; align-items: center; font-size: 12px; background: var(--black); border-radius: 8px; padding: 4px 6px; overflow: hidden; border-left: 3px solid var(--line); }
.cal .it img { width: 24px; height: 24px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.cal .it span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .it.instagram { border-left-color: var(--ig); } .cal .it.facebook { border-left-color: var(--fb); }
.cal .it.criacao { opacity: .65; } .cal .it.erro { background: var(--bad-soft); }
@media (max-width: 700px) { .cal { grid-template-columns: 1fr; } .cal .h, .cal .d.out { display: none; } .cal .d { min-height: 0; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 14px; backdrop-filter: blur(2px); }
.modal-box { width: min(620px, 100%); max-width: none; background: var(--side); border: 1px solid var(--line); }
.media-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.media-list .m { position: relative; width: 88px; height: 110px; border-radius: 10px; overflow: hidden; background: var(--black); }
.media-list .m img, .media-list .m video { width: 100%; height: 100%; object-fit: cover; }
.media-list .m button { position: absolute; top: 4px; right: 4px; padding: 0 7px; min-height: 22px; font-size: 12px; background: rgba(0,0,0,.7); border: 0; }
