:root {
  --ig-grad: linear-gradient(45deg, #FEDA75 0%, #FA7E1E 25%, #D62976 50%, #962FBF 75%, #4F5BD5 100%);
  --ig-rosa: #D62976; --ig-roxo: #962FBF; --ig-laranja: #FA7E1E; --ig-azul: #4F5BD5; --ig-amarelo: #FEDA75;
  --txt: #262626; --fraco: #737373; --borda: #DBDBDB; --fundo: #FAFAFA; --cartao: #FFFFFF; --hover: #F2F2F2;
  --ok: #1A9E55; --erro: #ED4956; --aviso: #E6A100;
  --raio: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--txt); background: var(--fundo); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ig-azul); }

/* ---------- barra do topo ---------- */
.topo { position: sticky; top: 0; z-index: 20; background: var(--cartao); border-bottom: 1px solid var(--borda); }
.topo::after { content: ""; display: block; height: 3px; background: var(--ig-grad); }
.topo-linha { display: flex; align-items: center; gap: 8px; padding: 8px 16px; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; margin-right: 8px; white-space: nowrap; }
.marca .anel { width: 30px; height: 30px; border-radius: 50%; background: var(--ig-grad); display: grid; place-items: center; }
.marca .anel span { width: 24px; height: 24px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 13px; }
.marca b { background: var(--ig-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.abas { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.abas a { padding: 7px 12px; border-radius: 8px; color: var(--txt); text-decoration: none; white-space: nowrap; font-weight: 500; }
.abas a:hover { background: var(--hover); }
.abas a.ativa { background: var(--txt); color: #fff; }
.espaco { flex: 1; }
.usuario { color: var(--fraco); font-size: 13px; white-space: nowrap; }

.btn { border: 1px solid var(--borda); background: var(--cartao); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.ig { background: var(--ig-grad); border: 0; color: #fff; padding: 8px 15px; }
.btn.ig:hover { filter: brightness(1.06); }
.btn.azul { background: #0095F6; border-color: #0095F6; color: #fff; }
.btn.azul:hover { background: #1877F2; }
.btn.perigo { color: var(--erro); }
.btn.peq { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icone-btn { border: 0; background: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; font-size: 16px; }
.icone-btn:hover { background: var(--hover); }

/* chips de conta (filtro e escolha) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--borda); background: var(--cartao); border-radius: 999px; padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.chip .bola { width: 10px; height: 10px; border-radius: 50%; }
.chip.on { border-color: var(--txt); background: var(--txt); color: #fff; }
.chip.on.grad { background: var(--ig-grad); border-color: transparent; }

/* ---------- conteúdo ---------- */
main { padding: 14px 16px 40px; max-width: 1500px; margin: 0 auto; }
.barra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.barra h2 { margin: 0 6px 0 0; font-size: 18px; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); }
.vazio { color: var(--fraco); padding: 30px; text-align: center; }

/* ---------- calendário ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; background: var(--borda); gap: 1px; }
.cal .sem { background: var(--cartao); text-align: center; font-size: 12px; font-weight: 600; color: var(--fraco); padding: 6px 0; text-transform: uppercase; }
.cal .dia { background: var(--cartao); min-height: 118px; padding: 6px; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 4px; }
.cal .dia:hover { background: #FCFCFC; }
.cal .dia.fora { background: #F7F7F7; color: #B0B0B0; }
.cal .dia.hoje .num { background: var(--ig-grad); color: #fff; }
.cal .num { font-weight: 600; font-size: 13px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .especial { font-size: 11px; font-weight: 600; color: var(--ig-rosa); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .bolhas { display: flex; flex-wrap: wrap; gap: 4px; }
.cal .mais { font-size: 11px; color: var(--fraco); align-self: center; }

/* bolinha de Story estilo Instagram */
.bolha { --t: 44px; width: var(--t); height: var(--t); border-radius: 50%; padding: 2px; background: var(--ig-grad); position: relative; cursor: pointer; flex: none; border: 0; }
.bolha .in { width: 100%; height: 100%; border-radius: 50%; border: 2px solid #fff; background: #EFEFEF center/cover no-repeat; display: grid; place-items: center; font-size: 14px; color: var(--fraco); }
.bolha.publicado { background: #C7C7C7; }
.bolha.erro { background: var(--erro); }
.bolha.rascunho, .bolha.semmidia { background: none; border: 2px dashed #B5B5B5; padding: 1px; }
.bolha .conta { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; }
.bolha .hora { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font-size: 9px; font-weight: 700; background: #fff; border-radius: 6px; padding: 0 3px; color: var(--txt); box-shadow: 0 0 0 1px var(--borda); }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; background: var(--cartao); }
table.t th, table.t td { padding: 9px 10px; border-bottom: 1px solid #EFEFEF; text-align: left; white-space: nowrap; }
table.t th { font-size: 12px; color: var(--fraco); font-weight: 600; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--cartao); }
table.t th .seta { opacity: .35; margin-left: 3px; }
table.t th.ord .seta { opacity: 1; color: var(--ig-rosa); }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover { background: var(--hover); }
table.t td.miniatura { width: 46px; padding: 4px 10px; }
table.t img.mini { width: 30px; height: 54px; object-fit: cover; border-radius: 4px; display: block; background: #eee; }
.etq { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #EFEFEF; color: var(--txt); }
.etq.agendado { background: #E8F0FE; color: #1A56DB; }
.etq.publicado { background: #E6F6EC; color: var(--ok); }
.etq.erro { background: #FDECEE; color: var(--erro); }
.etq.rascunho { background: #FFF6DB; color: #8A6100; }
.etq.publicando { background: #F3E8FD; color: var(--ig-roxo); }
.etq.cancelado { background: #EFEFEF; color: var(--fraco); }
.bola-conta { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---------- modal ---------- */
.fundo-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--cartao); border-radius: 14px; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal.estreito { width: min(440px, 100%); }
.modal.largo { width: min(1100px, 100%); }
.modal-topo { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--borda); position: sticky; top: 0; background: var(--cartao); z-index: 2; }
.modal-topo h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-corpo { padding: 16px; }
.modal-pe { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--borda); justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--cartao); }
.modal-pe .esq { margin-right: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.story-grade { display: grid; grid-template-columns: 250px 1fr; gap: 20px; }
.celular { width: 250px; aspect-ratio: 9/16; border-radius: 18px; background: #111; overflow: hidden; position: relative; display: grid; place-items: center; }
.celular img, .celular video { width: 100%; height: 100%; object-fit: cover; }
.soltar { border: 2px dashed #C7C7C7; border-radius: 18px; color: var(--fraco); text-align: center; cursor: pointer; background: #FAFAFA; width: 100%; height: 100%; display: grid; place-items: center; padding: 20px; }
.soltar.sobre { border-color: var(--ig-rosa); background: #FFF0F6; }
.soltar .grande { font-size: 34px; }
.trocar { position: absolute; top: 8px; right: 8px; }
.progresso { position: absolute; inset: auto 12px 12px 12px; height: 6px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; }
.progresso i { display: block; height: 100%; width: 0; background: var(--ig-grad); transition: width .2s; }
.msg-proc { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.55); text-align: center; padding: 20px; font-weight: 600; }

.campos { display: grid; gap: 12px; align-content: start; }
.campo label { display: block; font-size: 12px; font-weight: 600; color: var(--fraco); margin-bottom: 4px; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--borda); border-radius: 8px; background: #FAFAFA; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid #C13584; outline-offset: -1px; background: #fff; }
.linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ig-rosa); }
.alerta { padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.alerta.amarelo { background: #FFF6DB; color: #6B4B00; }
.alerta.vermelho { background: #FDECEE; color: #A3121F; }
.alerta.verde { background: #E6F6EC; color: #146B3A; }
.hist { font-size: 12px; color: var(--fraco); }
.hist div { padding: 3px 0; border-bottom: 1px solid #F3F3F3; }
details summary { cursor: pointer; color: var(--fraco); font-size: 13px; }

/* lote */
.lote-dist { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; padding: 10px; background: #FAFAFA; border-radius: 10px; margin-bottom: 12px; }
.lote-dist .campo { width: auto; }
.lote-dist input, .lote-dist select { width: auto; }
.lote-solta { border: 2px dashed #C7C7C7; border-radius: 12px; padding: 22px; text-align: center; color: var(--fraco); cursor: pointer; margin-bottom: 12px; }
.lote-solta.sobre { border-color: var(--ig-rosa); background: #FFF0F6; }
table.lote td { padding: 6px 8px; }
table.lote input { padding: 6px 8px; border: 1px solid var(--borda); border-radius: 6px; background: #FAFAFA; }
table.lote tbody tr { cursor: default; }
.barrinha { height: 4px; background: #EEE; border-radius: 2px; overflow: hidden; width: 90px; }
.barrinha i { display: block; height: 100%; width: 0; background: var(--ig-grad); }

/* campanha */
.trilha { display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 14px; }
.cartao-story { width: 150px; flex: none; cursor: pointer; }
.cartao-story .tela { width: 150px; aspect-ratio: 9/16; border-radius: 12px; background: #EFEFEF center/cover no-repeat; display: grid; place-items: center; color: var(--fraco); font-size: 28px; position: relative; border: 2px dashed transparent; }
.cartao-story .tela.semmidia { border-color: #C7C7C7; background-color: #FAFAFA; }
.cartao-story .rot { font-weight: 700; margin-top: 6px; }
.cartao-story .sub { font-size: 12px; color: var(--fraco); }
.cartao-story .etq { position: absolute; top: 6px; left: 6px; }

/* contas */
.contas { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.conta-card { padding: 16px; display: grid; gap: 10px; }
.conta-card .cab { display: flex; align-items: center; gap: 10px; }
.conta-card .cab .bolha { --t: 48px; }
.conta-card h3 { margin: 0; font-size: 16px; }
.conta-card .st { font-size: 13px; color: var(--fraco); }
.conta-card .acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.pagina-op { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--borda); border-radius: 10px; cursor: pointer; }
.pagina-op:hover { background: var(--hover); }
.pagina-op img { width: 36px; height: 36px; border-radius: 50%; }

/* aviso flutuante */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #262626; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 99; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast.erro { background: var(--erro); }

/* login */
.login-pg { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--fundo); }
.login-box { width: min(350px, 100%); padding: 32px 28px; text-align: center; display: grid; gap: 10px; }
.login-box .anel-g { width: 74px; height: 74px; border-radius: 50%; background: var(--ig-grad); display: grid; place-items: center; margin: 0 auto 6px; }
.login-box .anel-g span { width: 64px; height: 64px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 30px; }
.login-box h1 { margin: 0 0 10px; font-size: 26px; background: var(--ig-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-box input { width: 100%; padding: 10px; border: 1px solid var(--borda); border-radius: 6px; background: #FAFAFA; }

@media (max-width: 760px) {
  .topo-linha { padding: 8px 12px; }
  .marca { font-size: 16px; }
  .topo-linha .espaco { display: none; }
  .topo-linha .marca { margin-right: auto; }
  .topo-linha .abas { order: 9; width: 100%; }
  .topo-linha #filtro-contas { order: 10; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  main { padding: 10px 10px 40px; }
  .campo input, .campo select, .campo textarea, table.lote input, .login-box input { font-size: 16px; }
  .cal .dia { min-height: 70px; padding: 3px; }
  .cal .sem { font-size: 10px; }
  .cal .especial { font-size: 9px; }
  .bolha { --t: 30px; }
  .bolha .hora { display: none; }
  .story-grade { grid-template-columns: 1fr; }
  .celular { width: min(250px, 70vw); margin: 0 auto; }
  .linha2 { grid-template-columns: 1fr; }
  .fundo-modal { padding: 0; }
  .modal { max-height: 100vh; height: 100%; border-radius: 0; }
}
