:root{
  --csb-blue:#093262;
  --csb-blue-soft:#0f4b8c;
  --csb-green:#21a157;
  --csb-yellow:#f4b400;
  --text:#0f172a;
  --muted:#64748b;
  --bg:#f3f4f6;
  --card:#ffffff;
  --border:#e5e7eb;
  --radius:14px;
  --shadow:0 12px 26px rgba(15,23,42,0.08);
  --danger:#ef4444;
  --danger-soft:#fef2f2;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:var(--bg);
  overflow-x:hidden; /* impede estouro horizontal */
}

/* trava o scroll do fundo quando um modal estiver aberto */
body.modal-open{ overflow:hidden; }

.bg{
  position:fixed; inset:0;
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(33,161,87,0.15), transparent 60%),
    radial-gradient(1200px 600px at 90% 0%, rgba(15,75,140,0.18), transparent 60%),
    radial-gradient(800px 400px at 50% 100%, rgba(244,180,0,0.10), transparent 60%);
  pointer-events:none;
}

.topbar{
  position:sticky; top:0; z-index:20;
  background:rgba(243,244,246,0.75);
  backdrop-filter:saturate(160%) blur(10px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  max-width:1200px; margin:0 auto;
  padding:14px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.brand{display:flex; align-items:center; gap:10px}
.brand-badge{
  width:44px; height:44px;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  box-shadow:var(--shadow);
}

.brand-logo{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:6px; /* controla o “respiro” */
  display:block;
}

.brand-title{font-weight:800; font-size:16px}
.brand-sub{font-size:12px; color:var(--muted)}
.topbar-actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; min-width:0}
.userbox{display:flex; align-items:center; gap:10px; flex-wrap:wrap; min-width:0}
.userbox-meta{text-align:right; min-width:0; max-width:260px}
.userbox-name{font-weight:700; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.userbox-email{font-size:12px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

.app{padding:18px 0 44px}
.container{max-width:1200px; margin:0 auto; padding:0 16px}

.view{min-height:calc(100vh - 74px)}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}
.card-head{margin-bottom:12px}
.h1{font-size:26px; font-weight:800; margin:0 0 6px}
.h2{font-size:16px; font-weight:800; margin:0 0 6px}
.h3{font-size:14px; font-weight:800; margin:0 0 8px}
.muted{color:var(--muted)}
.small{font-size:12px}

.page-head{
  display:flex; justify-content:space-between; align-items:flex-start;
  gap:14px; margin:12px 0 14px;
}
.head-actions{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}

/* LISTA: força empilhar (Dados da lista em cima, Itens abaixo) */
.grid2-stack{
  grid-template-columns: 1fr !important;
}
.grid3{display:grid; grid-template-columns:repeat(3,1fr); gap:14px}
.grid4{display:grid; grid-template-columns:repeat(4,1fr); gap:12px}
.grid5{display:grid; grid-template-columns:1.25fr 1fr 1fr 1fr 1.25fr; gap:12px}

@media (max-width: 980px){
  .grid2{grid-template-columns:1fr}
  .grid3{grid-template-columns:1fr}
  .grid4{grid-template-columns:1fr 1fr}
  .grid5{grid-template-columns:1fr 1fr}
  /* Mantém nome/email visíveis até telas bem menores */
}

@media (max-width: 560px){
  .grid4{grid-template-columns:1fr}
  .grid5{grid-template-columns:1fr}
  .head-actions{width:100%}
  .head-actions .btn{flex:1}

  /* ✅ manter nome do logado visível no mobile */
  .topbar-inner{ gap:10px; }
  .topbar-actions{ gap:8px; }
  .userbox{ flex-wrap:nowrap; gap:8px; }
  .userbox-meta{
    display:block;           /* antes estava none */
    text-align:right;
    max-width:150px;         /* evita estourar */
  }
  .userbox-name{ font-size:12.5px; }
  .userbox-email{ font-size:11.5px; }

  /* Se a tela for muito pequena, esconde só o e-mail (mantém o NOME) */
  @media (max-width: 420px){
    .userbox-meta{ max-width:140px; }
    .userbox-email{ display:none; }
  }

  /* ✅ Modal mais “mobile friendly” */
  .modal-card{
    width: calc(100vw - 18px);
    margin: 18px auto;
    max-height: calc(100vh - 24px);
    border-radius: 16px;
  }
  .modal-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .modal-actions .btn{
    width:100%;
  }
}

/* ✅ evita estouro de textos longos (ex.: Federação/Entidade) */
.cardtitle,
.cardmeta,
.list-card-title,
.list-card-lines,
.list-card-lines .muted.small{
  word-break: break-word;
  overflow-wrap: anywhere;
}


.btn{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  display:inline-flex; gap:8px; align-items:center; justify-content:center;
  transition:transform .05s ease, box-shadow .12s ease, border-color .12s ease;
}
.btn:hover{box-shadow:0 10px 20px rgba(15,23,42,.08)}
.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.5; cursor:not-allowed; box-shadow:none}

.btn-primary{
  background:linear-gradient(135deg,var(--csb-green),#1db954);
  color:#fff;
  border-color:rgba(0,0,0,.0);
}
.btn-outline{
  border-color:rgba(15,75,140,.25);
  background:rgba(15,75,140,.03);
}
.btn-ghost{
  border-color:transparent;
  background:transparent;
}

.link{
  border:0; background:transparent; cursor:pointer; color:var(--csb-blue-soft);
  font-weight:800; padding:0; display:inline-flex; gap:6px; align-items:center;
}

.pill{
  display:inline-flex; gap:8px; align-items:center;
  border:1px solid var(--border);
  border-radius:999px;
  padding:7px 10px;
  font-size:12px;
  background:#fff;
  color:var(--muted);
  font-weight:800;
}
.pill i{font-size:14px}
.pill-gray{background:#f8fafc}
.pill-yellow{background:rgba(244,180,0,.14); border-color:rgba(244,180,0,.35); color:#8a5800}
.pill-blue{background:rgba(15,75,140,.10); border-color:rgba(15,75,140,.25); color:var(--csb-blue)}
.pill-green{background:rgba(33,161,87,.12); border-color:rgba(33,161,87,.25); color:#0f6b3a}
.pill-muted{background:#f1f5f9}

.sep{
  display:flex; align-items:center; gap:10px;
  margin:14px 0;
}
.sep:before, .sep:after{
  content:""; flex:1; height:1px; background:var(--border);
}
.sep span{color:var(--muted); font-size:12px; font-weight:900}

.sep2{height:1px; background:var(--border); margin:12px 0}

.form{display:grid; gap:12px}
.field{display:grid; gap:6px}
.field span{font-size:12px; color:var(--muted); font-weight:800}
/* Inputs “normais” (texto, número, email, etc) */
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  font:inherit;
  outline:none;
  background:#fff;
  width:100%;
  max-width:100%;
  min-width:0; /* essencial em grid/flex */
}

/* Campo com erro (validação) */
.field.field-error span{
  color: var(--danger);
}
.field.field-error input:not([type="checkbox"]):not([type="radio"]),
.field.field-error select,
.field.field-error textarea{
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}


/* Checkbox/Radio NÃO podem herdar estilo de input de texto */
.field input[type="checkbox"],
.field input[type="radio"]{
  width:auto;
  max-width:none;
  padding:0;
  border:none;
  background:transparent;
  border-radius:0;
}
.field textarea{min-height:120px; resize:vertical}
.field-inline{display:flex; gap:10px; align-items:center}

.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.row > *{min-width:0}
.row-between{display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:8px}

.breadcrumbs{display:flex; gap:8px; align-items:center; margin-bottom:6px}

.section{margin-top:14px}
.section-head{display:flex; justify-content:space-between; align-items:flex-end; gap:10px; margin:6px 0 10px}

.cards{display:grid; grid-template-columns:repeat(2,1fr); gap:14px}
@media (max-width: 980px){ .cards{grid-template-columns:1fr} }

.cardline{display:flex; justify-content:space-between; align-items:flex-start; gap:10px}
.cardtitle{font-weight:900; font-size:14px}
.cardmeta{font-size:12px; color:var(--muted); margin-top:3px}
.badgeRow{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px}
.cardactions{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}

.tablewrap{overflow:auto; border:1px solid var(--border); border-radius:14px}
table{width:100%; border-collapse:collapse; min-width:760px; background:#fff}
th, td{padding:10px 10px; border-bottom:1px solid var(--border); font-size:13px}
th{font-size:12px; color:var(--muted); text-align:left}
td.center, th.center{text-align:center}
td .btn{padding:8px 10px; border-radius:10px}
.td-actions{white-space:nowrap}

/* ===== People Admin: sticky header + paginação + cards ===== */
#peopleTable thead th{
  position:sticky;
  top:0;
  background:#fff;
  z-index:5;
}
#peopleTable thead th::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-1px;
  height:1px;
  background:var(--border);
}
.select-sm{
  height:40px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  font-weight:700;
}

.people-cards{display:none}
.people-card{
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  padding:12px;
}
.people-card .pc-head{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.people-card .pc-title{font-weight:1000; font-size:14px}
.people-card .pc-sub{color:var(--muted); font-size:12px; margin-top:3px; word-break:break-word}
.people-card .pc-grid{display:grid; grid-template-columns:1fr; gap:6px; margin-top:10px}
.people-card .pc-line{display:flex; justify-content:space-between; gap:10px; font-size:13px}
.people-card .pc-line .k{color:var(--muted); font-size:12px; white-space:nowrap}
.people-card .pc-line .v{font-weight:700; text-align:right; word-break:break-word}
.people-card .pc-actions{display:flex; gap:10px; justify-content:flex-end; margin-top:10px; flex-wrap:wrap}

@media (max-width: 860px){
  .people-tablewrap{display:none}
  .people-cards{display:grid; grid-template-columns:1fr; gap:12px}
  table{min-width:0}
}

.kpi{display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:8px 0 12px}
.kpi-item{border:1px dashed var(--border); border-radius:12px; padding:10px; min-width:0}
.kpi-val{
  font-size:18px;
  font-weight:900;
  white-space:normal;        /* permite quebrar linha */
  overflow-wrap:anywhere;    /* evita estouro */
  line-height:1.15;
}

/* ✅ KPIs responsivas no mobile (evita “Criada em” estourar) */
@media (max-width: 560px){
  .kpi{ grid-template-columns: 1fr 1fr; }
  .kpi-val{ font-size:16px; }
}
@media (max-width: 420px){
  .kpi{ grid-template-columns: 1fr; }
}

.filters{padding:12px}

/* ===== Histórico (timeline) ===== */
.hist-wrap{display:grid; gap:12px}
.hist-top{padding:6px 2px 2px}
.hist-top-title{font-weight:1000; font-size:15px}
.hist-top-sub{margin-top:2px}

.hist-day{margin-top:6px}
.hist-day-title{
  font-weight:900;
  font-size:12px;
  letter-spacing:.02em;
  color:var(--muted);
  margin:10px 0 6px;
  text-transform:uppercase;
}

.hist-list{display:grid; gap:10px}

.hist-item{display:grid; grid-template-columns:18px 1fr; gap:10px}
.hist-left{position:relative}
.hist-dot{
  width:10px; height:10px; border-radius:999px;
  border:2px solid var(--border);
  background:#fff;
  margin-top:14px;
  position:relative;
  z-index:2;
}
.hist-line{
  position:absolute;
  left:5px;
  top:26px;
  bottom:-10px;
  width:2px;
  background:var(--border);
}

.hist-card{
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  padding:10px 12px;
  box-shadow:0 10px 24px rgba(15,23,42,0.05);
}

.hist-row1{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.hist-action{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.hist-action-text{font-weight:900}
.hist-when{white-space:nowrap}

.hist-row2{display:flex; align-items:center; gap:8px; margin-top:4px}

.hist-pill{
  font-size:11px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  font-weight:900;
}
.hist-info{background:#eff6ff}
.hist-ok{background:#ecfdf5}
.hist-warn{background:#fff7ed}
.hist-danger{background:#fef2f2}

.hist-chips{display:flex; flex-wrap:wrap; gap:6px; margin-top:8px}
.hist-chip{
  font-size:12px;
  border:1px dashed var(--border);
  border-radius:999px;
  padding:5px 8px;
  background:#fff;
}

.hist-details{margin-top:8px}
.hist-details summary{
  cursor:pointer;
  font-weight:900;
  font-size:12px;
  color:var(--muted);
}
.hist-json{
  margin:8px 0 0;
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#f9fafb;
  font-size:12px;
  overflow:auto;
  max-height:240px;
}

/* NOVO toast padrão “CTPA” (mais limpo e com título) */
.toast{
  position:fixed; right:16px; bottom:16px; z-index:60;
  background:#fff; color:var(--text);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 12px;
  box-shadow:0 14px 34px rgba(0,0,0,.14);
  max-width:460px;
  display:flex; gap:10px; align-items:flex-start;
}
.toast .dot{
  width:10px; height:10px; border-radius:999px; margin-top:6px; flex:0 0 auto;
  background:#2563eb;
}
.toast.ok .dot{background:#16a34a}
.toast.err .dot{background:#dc2626}
.toast.warn .dot{background:#f59e0b}
.toast .t-body{min-width:0}
.toast .t-title{font-weight:900; font-size:13px; margin:0}
.toast .t-msg{font-size:12px; color:var(--muted); margin-top:4px; line-height:1.35; word-break:break-word}
.toast .t-x{margin-left:auto; border:0; background:transparent; cursor:pointer; color:var(--muted); font-weight:1000}

.modal{position:fixed; inset:0; z-index:40}
.modal-backdrop{position:absolute; inset:0; background:rgba(2,6,23,.55)}
.modal-card{
  position:relative;
  width:min(760px, calc(100% - 28px));
  margin:60px auto;
  background:#fff;
  border-radius:18px;
  box-shadow:0 24px 60px rgba(0,0,0,.22);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  max-height:calc(100vh - 48px);
}
.modal-head{display:flex; justify-content:space-between; align-items:center; padding:14px 14px 0}
.modal-title{font-weight:900; font-size:15px}
.modal-body{
  padding:12px 14px 12px;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.modal-actions{display:flex; justify-content:flex-end; gap:10px; padding:0 14px 14px}
@media (max-width:560px){ .modal-card{margin:24px auto} }

.auth-wrap{
  max-width:1100px; margin:0 auto; padding:16px;
  display:grid; grid-template-columns:1fr 0.8fr; gap:14px; align-items:start;
}
@media (max-width: 980px){ .auth-wrap{grid-template-columns:1fr} }

.bullets{margin:10px 0 0; padding-left:18px}
.bullets li{margin:8px 0}

/* Modal "Como funciona" */
.how-grid{display:grid; gap:12px}
.how-section{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:rgba(15,75,140,.03);
}
.steps{margin:10px 0 0; padding-left:18px}
.steps li{margin:8px 0}

.callout{
  display:flex;
  gap:10px;
  align-items:flex-start;
  border-radius:14px;
  padding:12px;
  border:1px solid rgba(245,158,11,.35);
  background:rgba(245,158,11,.10);
}
.callout i{margin-top:2px}
.callout.warn b{display:block; margin-bottom:4px}

.paylink{
  border:1px dashed rgba(15,75,140,.35);
  border-radius:14px;
  padding:12px;
  background:rgba(15,75,140,.04);
}
.paylink-row{display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap}
.paylink-actions{display:flex; gap:10px; flex-wrap:wrap}

.tabs{display:flex; gap:10px; margin:12px 0}
.tab{
  border:1px solid var(--border);
  border-radius:999px;
  background:#fff;
  padding:8px 12px;
  cursor:pointer;
  font-weight:900;
  color:var(--muted);
}
.tab.active{color:var(--text); border-color:rgba(15,75,140,.35); background:rgba(15,75,140,.06)}
.tabpane{padding:10px 0}

/* garante que o atributo hidden sempre esconda */
[hidden] { display: none !important; }


.toast{ animation: toastIn .16s ease-out; }
@keyframes toastIn{
  from{ transform: translateY(8px); opacity:0; }
  to{ transform: translateY(0); opacity:1; }
}


/* Cadastro de Pessoas */
.colsbox{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:6px 0}
.colcheck{display:flex;align-items:center;gap:10px}
.cpfname{line-height:1.1}


/* Autocomplete de Entidade (Criar lista) */
.ac-list{display:grid; gap:8px}
.ac-item{
  width:100%;
  text-align:left;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
}
.ac-item:hover{box-shadow:0 10px 20px rgba(15,23,42,.08)}
.ac-title{font-weight:900; font-size:13px}
.ac-sub{margin-top:4px}
.pill-warn{background:rgba(245,158,11,.14); border-color:rgba(245,158,11,.35); color:#8a5800}


/* ===== Destaque "Criar entidade" no autocomplete ===== */
.ac-item.ac-create{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  text-align:left;

  background:rgba(34,197,94,.12); /* verde claro */
  border:1px solid rgba(34,197,94,.25);
}

.ac-item.ac-create:hover{
  background:rgba(34,197,94,.16);
  border-color:rgba(34,197,94,.35);
}

.ac-item.ac-create:focus-visible{
  outline:3px solid rgba(34,197,94,.25);
  outline-offset:2px;
}

.ac-item.ac-create .ac-left{
  display:flex;
  align-items:center;
  justify-content:center;
}

.ac-item.ac-create .ac-plus{
  width:34px;
  height:34px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;

  background:rgba(22,163,74,.14);      /* verde mais escuro (fundo) */
  border:1px solid rgba(22,163,74,.35); /* verde mais escuro (borda) */
  color:rgba(22,163,74,.95);            /* verde mais escuro (ícone) */
}

.ac-item.ac-create .ac-plus i{
  font-size:14px;
  line-height:1;
}

.ac-item.ac-create .ac-right{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}


/* Aviso abaixo da entidade selecionada (Criar lista) */
.ent-warn-box{
  margin-top:10px;
  display:flex;
  gap:10px;
  align-items:flex-start;

  padding:10px 12px;
  border-radius:12px;

  background:rgba(245,158,11,.12);
  border:1px solid rgba(245,158,11,.35);
  color:#8a5800;
}

.ent-warn-box i{
  font-size:16px;
  margin-top:2px;
  flex:0 0 auto;
}

.ent-warn-title{
  font-weight:900;
  font-size:13px;
  line-height:1.1;
}

.ent-warn-sub{
  margin-top:4px;
  font-size:12px;
  opacity:.9;
  line-height:1.25;
}



/* =========================
   Busy / Loading UI (delayed)
   ========================= */
#topProgress{
  position:fixed;
  top:0; left:0; right:0;
  height:3px;
  z-index:99999;
  opacity:0;
  pointer-events:none;
  background: linear-gradient(90deg, rgba(46,204,113,.2), rgba(52,152,219,.95), rgba(241,196,15,.95), rgba(52,152,219,.95), rgba(46,204,113,.2));
  background-size: 220% 100%;
  animation: topProgressMove 1.05s linear infinite;
  transition: opacity .18s ease;
}
#topProgress.show{ opacity:1; }

@keyframes topProgressMove{
  0%{ background-position: 0% 0; }
  100%{ background-position: 220% 0; }
}

#busyOverlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:99998;
  opacity:0;
  pointer-events:none;
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity .18s ease;
}
#busyOverlay.show{
  opacity:1;
  pointer-events:auto;
}

#busyOverlay .busy-card{
  width:min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.18);
  padding: 16px 16px 14px;
  border: 1px solid rgba(0,0,0,.06);
}

#busyOverlay .busy-brand{
  display:flex;
  align-items:center;
  gap:12px;
}
#busyOverlay .busy-brand img{
  width:46px;
  height:46px;
  object-fit:contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.10));
}

#busyOverlay .busy-text{ min-width:0; }
#busyOverlay .busy-title{
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 14px;
  line-height: 1.15;
}
#busyOverlay .busy-sub{
  margin-top: 3px;
  font-size: 12px;
  opacity: .72;
  line-height: 1.2;
}

#busyOverlay .busy-bar{
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(0,0,0,.06);
}
#busyOverlay .busy-bar-inner{
  height:100%;
  width:38%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(46,204,113,.35), rgba(52,152,219,.95), rgba(241,196,15,.95));
  animation: busyBarMove 1.0s ease-in-out infinite;
}

@keyframes busyBarMove{
  0%{ transform: translateX(-60%); width: 35%; }
  50%{ transform: translateX(60%);  width: 55%; }
  100%{ transform: translateX(-60%); width: 35%; }
}
/* =========================
   Listas gerais: resumo (totais por status)
   ========================= */
.summarybar{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:10px;
}

.summarybar .sumchip{
  display:inline-flex;
  gap:6px;
  align-items:baseline;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border, #e5e7eb);
  background:#fff;
  font-size:13px;
  line-height:1;
}

.summarybar .sumchip b{ font-weight:700; }

.summarybar .sum-draft{ background: #fff7ed; border-color:#fed7aa; }
.summarybar .sum-pending{ background: #eff6ff; border-color:#bfdbfe; }
.summarybar .sum-paid{ background: #ecfdf5; border-color:#bbf7d0; }
.summarybar .sum-total{ background: #f3f4f6; border-color:#e5e7eb; }


.pill-review{
  background:#fff7ed;
  border-color:#fed7aa;
  color:#9a3412;
  font-weight:800;
}


/* =========================
   Billing: Busy overlay + Top progress
   ========================= */
#topProgress{
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: rgba(20, 120, 255, .85);
  z-index: 9999;
  opacity: 0;
  transition: opacity .15s ease, width .35s ease;
}
#topProgress.show{
  opacity: 1;
  width: 100%;
}

#busyOverlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 18, 40, 0.35);
  backdrop-filter: blur(2px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
#busyOverlay.show{
  opacity: 1;
  pointer-events: auto;
}

.busy-card{
  width: min(520px, calc(100vw - 28px));
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(15,75,140,0.12);
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: 0 18px 55px rgba(0,0,0,0.18);
}
.busy-brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.busy-brand img{
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.busy-title{
  font-weight: 900;
  font-size: 14px;
}
.busy-sub{
  margin-top: 2px;
  font-size: 12px;
  opacity: .75;
}
.busy-bar{
  margin-top: 12px;
  height: 10px;
  background: rgba(15,75,140,0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(15,75,140,0.10);
}
.busy-bar-inner{
  height: 100%;
  width: 40%;
  background: rgba(20, 120, 255, .65);
  border-radius: 999px;
  animation: busySlide 1.05s infinite ease-in-out;
}
@keyframes busySlide{
  0%{ transform: translateX(-80%); }
  50%{ transform: translateX(120%); }
  100%{ transform: translateX(-80%); }
}

/* =========================
   Billing: Compact cards (padrão index)
   ========================= */
.bill-card{
  padding: 14px;
}

.bill-row{
  display:flex;
  gap:12px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}

.bill-left{
  min-width: 260px;
  flex: 1;
}

.bill-title{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.bill-entity{
  font-weight: 900;
  font-size: 16px;
  line-height: 1.15;
}

.bill-sub{
  margin-top: 6px;
}

.bill-right{
  display:flex;
  gap:12px;
  align-items:flex-end;
  justify-content:flex-end;
  flex-wrap:wrap;
  text-align:right;
}

.bill-total .bill-money{
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
}

.bill-paylink{
  width: min(420px, 100%);
  text-align:left;
  background: rgba(15,75,140,0.04);
  border: 1px solid rgba(15,75,140,0.10);
  border-radius: 12px;
  padding: 10px 12px;
}

.bill-paylink-k{
  font-weight: 900;
  letter-spacing: .2px;
}

.bill-paylink-v{
  margin-top: 4px;
  font-weight: 700;
  font-size: 12.5px;
  word-break: break-word;
}

.bill-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
}

@media (max-width: 760px){
  .bill-right{
    width: 100%;
    justify-content:space-between;
    text-align:left;
    align-items:stretch;
  }
  .bill-actions{
    justify-content:flex-start;
  }
}


/* =========================
   Billing page spacing (igual index)
   ========================= */
.app{
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 18px 50px;
}

@media (max-width: 520px){
  .app{ padding: 12px 12px 40px; }
}

/* grid 2 colunas no desktop */
.billing-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 980px){
  .billing-grid{
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================
   Card padrão index (compacto)
   ========================= */
.list-card{
  padding: 16px;
  border-radius: 16px;
}

.list-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.list-card-title{
  font-weight: 900;
  font-size: 16px;
  line-height: 1.2;
}

.btn-sm{
  padding: 10px 12px !important;
  border-radius: 14px !important;
  font-weight: 800 !important;
}

.list-card-lines{
  margin-top: 8px;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.list-card-foot{
  margin-top: 10px;
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:10px;
}

.list-card-price{
  font-weight: 900;
  font-size: 18px;
  white-space: nowrap;
}

/* Billing cards: fonte um pouco maior (sem exagero) */
.list-card-lines .muted.small{
  font-size: 13px;           /* era 12px */
  line-height: 1.35;
}

.list-card-title{
  font-size: 17px;           /* era 16px */
}

.list-card-price{
  font-size: 19px;           /* era 18px */
}

/* opcional: deixa o badge um tiquinho maior */
.pill{
  font-size: 12.5px;         /* era 12px */
}



/* ---- Billing: seleção / batch ---- */
.batchbar{
  display:flex;
  gap:12px;
  align-items:flex-end;
  justify-content:space-between;
  padding:12px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  background:rgba(0,0,0,.18);
}
.batchbar-title{ font-weight:800; }
.batchbar-meta{ font-size:13px; opacity:.9; margin-top:4px; }
.batchbar-right{ display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; justify-content:flex-end; }
.list-card-select{
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
}
.list-card-select input{ width:18px; height:18px; }


  /* Garantir camadas corretas */
  #toast{
    position: fixed !important;
    z-index: 99999 !important; /* acima de modal */
  }
  #modal{
    z-index: 9000 !important;
  }
  #busyOverlay{
    z-index: 95000 !important; /* acima de tudo enquanto carregando */
  }
  #topProgress{
    z-index: 95001 !important;
  }

  /* Modal sempre encaixado na viewport (desktop e mobile) */
  #modal .modal-card{
    width: min(760px, calc(100vw - 24px)) !important;
    max-width: 760px !important;
    max-height: calc(100vh - 24px) !important;
    margin: 12px auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #modal .modal-body{
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Em telas menores, força 1 coluna no grid do modal */
  @media (max-width: 820px){
    #modal .modal-body > .grid{
      grid-template-columns: 1fr !important;
    }
  }



  /* Billing: subtítulo abaixo do título do card (Modalidade + Tipo) */
.list-card-titlebox{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.list-card-submeta{
  margin-top:2px;
  font-size:12.5px;
  line-height:1.2;
}

/* Billing: linha 2 (ATLETAS / TÉCNICOS) com destaque maior */
.list-card-type{
  font-weight: 900;
  font-size: 13.5px;
  line-height: 1.15;
  color: var(--csb-blue-soft);
  margin-top: 2px;
}


/* =========================
   Cards: menu de ações no mobile
   ========================= */
.actions-menu{ position:relative; }
.actions-menu summary{ list-style:none; cursor:pointer; }
.actions-menu summary::-webkit-details-marker{ display:none; }

.cardactions-inline{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.cardactions-menu{ display:none; }

.actions-menu .menu-pop{
  position:absolute;
  right:0;
  top:44px;
  width:min(220px, 80vw);
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:0 18px 48px rgba(0,0,0,.14);
  padding:8px;
  z-index:30;
}

.actions-menu .menu-item{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  cursor:pointer;
  font-weight:800;
  color:var(--text);
  text-align:left;
}
.actions-menu .menu-item:hover{
  background: rgba(15,75,140,.05);
  border-color: rgba(15,75,140,.10);
}
.actions-menu .menu-item.danger{
  color: var(--danger);
}
.actions-menu .menu-item.danger:hover{
  background: var(--danger-soft);
  border-color: rgba(239,68,68,.20);
}

/* ✅ no mobile, esconde os botões soltos e mostra o menu */
@media (max-width: 560px){
  .cardactions-inline{ display:none; }
  .cardactions-menu{ display:block; }
}


/* ===== Dashboard menu (desktop + mobile) ===== */
.dash-menu .menu-pop{
  top: 48px;               /* distância do botão */
  min-width: 240px;
}

@media (max-width: 560px){
  .dash-menu summary.btn{
    flex: 1;               /* fica do tamanho do Criar Lista */
    justify-content: center;
  }
  .dash-menu .menu-pop{
    width: min(260px, 92vw);
  }
}

/* opcional: no desktop deixar o botão "Menu" mais compacto */
@media (min-width: 561px){
  .dash-menu summary.btn{
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ========= Navegação / Page Head mais estável ========= */
.page-head{
  flex-wrap:wrap;
}
.page-head > div:first-child{
  flex:1;
  min-width:260px;
}
.head-actions{
  flex-shrink:0;
  align-items:flex-start;
}

/* ========= Menu “Exportar” ========= */
.export-menu .menu-pop{
  top: 46px;
  min-width: 220px;
}

/* Mobile: header mais “organizado” */
@media (max-width: 560px){
  .page-head{
    flex-direction:column;
    align-items:stretch;
  }
  .head-actions{
    width:100%;
    justify-content:flex-start; /* exportar fica mais natural do que colado à direita */
  }
  .export-menu summary.btn{
    width:100%;
    justify-content:center;
  }
  .export-menu .menu-pop{
    width: min(260px, 92vw);
  }
}


/* ===== Botão VOLTAR mais intuitivo ===== */
.backbtn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(15,75,140,.20);
  background:rgba(15,75,140,.04);
  color:var(--csb-blue-soft);
  cursor:pointer;
  font-weight:900;
}
.backbtn:hover{
  background:rgba(15,75,140,.07);
  box-shadow:0 10px 20px rgba(15,23,42,.06);
}
.backbtn:active{ transform: translateY(1px); }

/* melhora o alinhamento do breadcrumb */
.breadcrumbs{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.breadcrumbs .muted{ white-space:nowrap; }

/* Mobile: botão voltar com área de toque maior */
@media (max-width:560px){
  .backbtn{ padding:10px 12px; }
}


/* =========================
   Boot: evita "flash" da tela de login antes do auth resolver
   ========================= */
body.booting .view{
  display: none !important;
}
