:root{
  --bg:#0f111a;
  --panel:#161a27;
  --panel2:#1b2030;
  --text:#e6e8ee;
  --muted:#a8afc1;
  --line:#2a3146;
  --primary:#0078d4; /* Windows 10 blue */
  --danger:#d83b01;
  --shadow: 0 14px 40px rgba(0,0,0,.55);
  --radius: 10px;
  --focus: 0 0 0 3px rgba(0,120,212,.25);
  font-family: "Segoe UI", system-ui, -apple-system, Arial;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background: var(--bg);
  color:var(--text);
}


a{ color:inherit; }

.topbar{
  position: sticky;
  top:0;
  z-index: 5;
  background: rgba(15,17,26,.92);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--line);
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.topbar__title{ font-size:16px; font-weight:600; letter-spacing:.2px; }
.topbar__actions{ display:flex; gap:10px; align-items:center; }

.container{ max-width: 1200px; margin: 18px auto; padding: 0 14px; }

.card{
  background: var(--panel);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  overflow:hidden;
}


.card__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px;
  border-bottom:1px solid var(--line);
}

.muted{ color: var(--muted); }
.row{ display:flex; align-items:center; }
.gap{ gap:10px; }

.table-wrap{ overflow:auto; }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 0;
}
.table th, .table td{
  padding:12px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align: middle;
}
.table thead th{
  background: rgba(27,32,48,.85);
  position: sticky;
  top: 0;
}
.badge{
  display:inline-flex;
  padding:4px 10px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-size:12px;
}
.badge--ok{ border-color: rgba(0,120,212,.45); }
.badge--no{ border-color: rgba(216,59,1,.45); }

.btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  cursor:pointer;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{ background: rgba(255,255,255,.06); }
.btn:active{ transform: translateY(1px); }
.btn:focus{ outline:none; box-shadow: var(--focus); }

.btn-primary{
  background: rgba(0,120,212,.18);
  border-color: rgba(0,120,212,.55);
}
.btn-primary:hover{ background: rgba(0,120,212,.25); }

.btn-danger{
  background: rgba(216,59,1,.18);
  border-color: rgba(216,59,1,.55);
}
.btn-danger:hover{ background: rgba(216,59,1,.25); }

.iconbtn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  width:34px;
  height:34px;
  border-radius: 8px;
  cursor:pointer;
}
.iconbtn:hover{ background: rgba(255,255,255,.06); }

.input, .select, .textarea{
  width:100%;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding:10px 10px;
  border-radius: 8px;
}
.input:focus, .select:focus, .textarea:focus{
  outline:none;
  box-shadow: var(--focus);
  border-color: rgba(0,120,212,.6);
}
.textarea{ resize: vertical; }

.field label{ display:block; margin-bottom:6px; color: var(--muted); font-size:12px; }
.field small{ display:block; margin-top:6px; }

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display:none;
  z-index: 20;
}
.modal[aria-hidden="false"]{ display:block; }

.modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.55);
}

.modal__panel{
  position: relative;
  width:min(860px, calc(100% - 22px));
  margin: 6vh auto;
  background: var(--panel);
  border:1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
  overflow:hidden;
}

.modal__panel--sm{
  width:min(520px, calc(100% - 22px));
}

.modal__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px;
  border-bottom:1px solid var(--line);
}
.modal__title{ font-weight:600; }

.modal__body{ padding:14px; }
.modal__footer{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding:14px;
  border-top:1px solid var(--line);
}

.alertmsg{ line-height: 1.4; }

@media (max-width: 820px){
  .grid2{ grid-template-columns: 1fr; }
  .topbar{ flex-direction: column; align-items: stretch; }
  .topbar__actions{ flex-wrap: wrap; }
}
/* UPPERCASE (visual) */
.uppercase {
  text-transform: uppercase;
}
.input-error, .select.input-error, .textarea.input-error{
  border-color: rgba(216,59,1,.75) !important;
  box-shadow: 0 0 0 3px rgba(216,59,1,.20) !important;
}
.field-error{
  min-height: 16px;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(216,59,1,.95);
}

.input-error{
  border-color: rgba(216,59,1,.75) !important;
  box-shadow: 0 0 0 3px rgba(216,59,1,.20) !important;
}

.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}
.inline-status{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:6px;
  min-height: 16px;
}

.cpf-status-icon{
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  line-height:1;
}

.cpf-status-text{
  font-size:12px;
  color: rgba(255,255,255,.70);
}

/* ok (✔ verde) */
.cpf-ok .cpf-status-icon{ color: rgba(46, 204, 113, .95); }
.cpf-ok .cpf-status-text{ color: rgba(46, 204, 113, .95); }

/* verificando (… rodando) */
.cpf-checking .cpf-status-icon{
  color: rgba(255,255,255,.65);
  animation: cpfSpin .9s linear infinite;
}
@keyframes cpfSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
/* === PAGER FIX (layout quebrado) === */
.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding:12px;
  margin-top:12px;
  border-top:1px solid var(--border, #2a3142);
}

.pager button.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;         /* mantém quadrado */
  height:38px;
  padding:0;
  line-height:1;
}

.pager__info{
  display:flex;
  align-items:center;
  gap:10px;
  flex: 1 1 auto;     /* ocupa o meio */
  min-width:180px;
}

.pager__perpage{
  display:flex;
  align-items:center;
  gap:8px;
  flex: 0 0 auto;
}

.pager__perpage .select{
  width:auto !important;
  min-width:90px;
  max-width:140px;
}

@media (max-width: 640px){
  .pager{
    justify-content:flex-start;
  }
  .pager__info{
    flex: 1 1 100%;
  }
}
/* ===== Fix definitivo: tabela com scroll, pager normal ===== */
.table-wrap{
  overflow-x: auto;   /* somente horizontal */
  overflow-y: hidden;
}

/* remove o min-width agressivo que quebra layout em telas menores */
.table{
  min-width: 0;       /* deixa a tabela se adaptar */
}

/* garante que o pager NÃO seja afetado por layout interno */
.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding:12px 14px;
  border-top:1px solid var(--line);
  margin-top: 0;      /* colado no card, sem "pular" */
}

/* se quiser manter a tabela larga, use esta alternativa:
   em vez de min-width fixo, use largura mínima menor */
@media (min-width: 821px){
  .table{ min-width: 980px; } /* só em telas grandes */
}
/* ===== PAGER "faixa Windows 10" colado na tabela ===== */

/* garante que o scroll seja só da tabela */
.table-wrap{
  overflow-x:auto;
  overflow-y:hidden;
}

/* remove min-width fixo que empurra o layout (opcional, mas recomendado) */
.table{ min-width: 0; }

/* faixa do pager colada no final do card */
.pager{
  position: sticky;     /* fica visível se rolar dentro do card */
  bottom: 0;
  z-index: 3;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;

  padding:10px 14px;
  margin:0;             /* colado */
  border-top:1px solid var(--line);

  /* faixa estilo Windows 10 */
  background: rgba(27,32,48,.92);   /* igual/parecido com thead */
  backdrop-filter: blur(6px);
}

/* “alinha bonito” */
.pager__info{
  display:flex;
  align-items:center;
  gap:10px;
  flex: 1 1 auto;
  min-width: 200px;
}

/* botões do pager mais “quadradinhos” */
.pager button.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:36px;
  padding:0;
  line-height:1;
}

/* bloco “Por página” compacto */
.pager__perpage{
  display:flex;
  align-items:center;
  gap:8px;
  flex: 0 0 auto;
}

.pager__perpage .select{
  width:auto !important;
  min-width: 92px;
  max-width: 140px;
  padding:8px 10px;
}

/* separador sutil no total */
#totalInfo{
  opacity:.9;
}

/* mobile: quebra em linhas sem ficar estranho */
@media (max-width: 640px){
  .pager{
    justify-content:flex-start;
  }
  .pager__info{
    flex: 1 1 100%;
  }
}
/* ===== Pager alinhado (setas + info na mesma linha) ===== */

.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

/* grupo esquerdo: ◀ Página 1/22 Total: 548 ▶ */
.pager__left{
  display:flex;
  align-items:center;
  gap:12px;
  flex: 1 1 auto;
}

/* info central */
.pager__info{
  display:flex;
  align-items:center;
  gap:10px;
  white-space: nowrap;
}

/* botões quadrados */
.pager__left .btn{
  width:42px;
  height:36px;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* mobile */
@media (max-width: 640px){
  .pager{
    flex-direction:column;
    align-items:flex-start;
  }

  .pager__left{
    flex-wrap:wrap;
  }
}
/* ===== PAGER: setas + texto na mesma linha (override forte) ===== */
.card > .pager#pager{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:16px !important;

  flex-wrap:nowrap !important;   /* <<< impede quebrar */
}

/* bloco esquerdo: ◀ + texto + ▶ */
.card > .pager#pager .pager__left{
  display:flex !important;
  align-items:center !important;
  gap:12px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;       /* <<< permite encolher sem quebrar */
}

/* texto do meio */
.card > .pager#pager .pager__info{
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  white-space:nowrap !important; /* <<< não quebra "Página..." */
  min-width: 0 !important;
}

/* “Por página” à direita, sem forçar linha */
.card > .pager#pager .pager__perpage{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  flex: 0 0 auto !important;
  white-space:nowrap !important;
}

/* botões quadrados */
.card > .pager#pager .pager__left > .btn{
  width:42px !important;
  height:36px !important;
  padding:0 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
}

/* select compacto */
.card > .pager#pager .pager__perpage .select{
  width:auto !important;
  min-width:92px !important;
  max-width:140px !important;
  padding:8px 10px !important;
}

/* Mobile: aí sim pode quebrar (controle) */
@media (max-width: 640px){
  .card > .pager#pager{
    flex-wrap:wrap !important;
    justify-content:flex-start !important;
  }
}
.pager#pager{ display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:nowrap; }
.pager#pager .pager__left{ display:flex; align-items:center; gap:12px; }
.pager#pager .pager__info{ display:flex; align-items:center; gap:10px; white-space:nowrap; }
.pager#pager .pager__perpage{ display:flex; align-items:center; gap:8px; white-space:nowrap; }
/* linha "salvando" */
tr.is-saving td { opacity: .65; }
tr.is-saving td:first-child { opacity: 1; }

/* input override bloqueado */
.inOverride:disabled { opacity:.55; cursor:not-allowed; }

/* toast simples */
.toast{
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  min-width: 240px;
}
.toast .t1{ font-weight:800; font-size:13px; margin-bottom:2px; }
.toast .t2{ color:var(--muted); font-size:12px; }
.toast.ok{ border-color: rgba(46,204,113,.35); }
.toast.err{ border-color: rgba(216,59,1,.35); }
.toast.warn{ border-color: rgba(255,193,7,.35); }