:root{
  --bg0:#07070b;
  --glass-bg: rgba(18, 18, 26, 0.72);
  --glass-bg-2: rgba(18, 18, 26, 0.55);
  --glass-border: rgba(255,255,255,0.14);
  --text:#f3f4f6;
  --muted:#aeb3bf;
  --muted2:#8b90a1;
}
*{ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

.bg-app{
  min-height:100vh;
  background:
    radial-gradient(1200px 800px at 10% 10%, rgba(0,255,209,.16), transparent 60%),
    radial-gradient(1000px 700px at 90% 30%, rgba(121,82,255,.18), transparent 60%),
    radial-gradient(900px 600px at 50% 100%, rgba(255,0,122,.12), transparent 60%),
    var(--bg0);
  color: var(--text);
}

.glass{
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
}

.navbar .btn{ border-radius: 12px; }
.navbar .nav-link{
  font-size: .95rem;
  padding: .4rem .6rem;
  color: rgba(255,255,255,0.55);
  transition: color .15s ease;
}
.navbar .nav-link:hover{ color: #fff; }
.navbar .nav-link.active{ color: #fff; }
.navbar-toggler:focus{ box-shadow: none; }
.card.glass{ box-shadow: 0 18px 60px rgba(0,0,0,.35); }

.text-muted{ color: var(--muted) !important; }
.small.text-muted{ color: var(--muted2) !important; }

.form-control, .form-select{
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
  border-radius: 14px;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-control::placeholder{ color: rgba(243,244,246,.45); }
.form-control:focus, .form-select:focus{
  background: rgba(255,255,255,0.10);
  border-color: rgba(13,110,253,0.70);
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.18);
  color:#fff;
}

.btn{
  border-radius: 14px;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{ box-shadow: 0 10px 26px rgba(13,110,253,.18); }
.btn-outline-light{ border-color: rgba(13,110,253,0.45); color: #fff; }
.btn-outline-light:hover{ background: rgba(13,110,253,0.12); border-color: rgba(13,110,253,0.60); color: #fff; }

.badge{ border-radius: 999px; }

.nav-pills .nav-link{
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text);
}
.nav-pills .nav-link.active{
  background: rgba(13,110,253,0.20);
  border-color: rgba(13,110,253,0.55);
}

/* DataTables layout */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input{
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
  border-radius: 12px;
  padding: .35rem .55rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate{
  color: rgba(243,244,246,.75) !important;
}
.dataTables_wrapper .pagination .page-link{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
  color: var(--text);
  border-radius: 12px;
  margin: 0 .15rem;
}
.dataTables_wrapper .pagination .page-item.active .page-link{
  background: rgba(13,110,253,0.35);
  border-color: rgba(13,110,253,0.55);
}

#pagination .page-link{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
  color: var(--text);
  border-radius: 10px;
  margin: 0 2px;
  padding: .35rem .65rem;
  font-size: .85rem;
}
#pagination .page-item.active .page-link{
  background: rgba(13,110,253,0.35);
  border-color: rgba(13,110,253,0.55);
  color: #fff;
}
#pagination .page-item.disabled .page-link{
  background: transparent;
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.30);
}
#pagination .page-link:hover:not(.disabled){
  background: rgba(255,255,255,0.10);
}

/* Table readability */
.table{
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,0.045);
  --bs-table-hover-bg: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: rgba(255,255,255,0.10);
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th{
  color: rgba(243,244,246,.92);
  font-weight: 600;
  font-size: .84rem;
  letter-spacing: .02em;
  white-space: nowrap;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.table thead th:last-child{ border-right: none; }
.table tbody td{
  color: rgba(243,244,246,.88);
  font-size: .88rem;
  vertical-align: middle;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
}
.table tbody td:last-child{ border-right: none; }
.table td, .table th{
  padding: .85rem 1rem;
}

.table-responsive{
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
}

/* Sticky header */
#tbl thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12,12,18,.92);
  backdrop-filter: blur(10px);
}

/* Compact buttons in table */
.table .btn.btn-sm{
  padding: .30rem .55rem;
  border-radius: 12px;
}

/* Modal */
.modal-content.glass{ border-radius: 20px; }
.modal-header .modal-title{ letter-spacing: .01em; }

/* Global loader */
.global-loader{
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.global-loader .box{
  background: rgba(20,20,28,.78);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 240px;
}
.global-loader .msg{ font-size: 14px; color: #e5e7eb; }

/* Mobile drawer */
.drawer-backdrop{
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(0,0,0,.50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.drawer{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  z-index: 1050;
  background: rgba(12,12,20,.96);
  border-left: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 20px;
  transform: translateX(100%);
  transition: transform .25s ease;
}
.drawer.open{ transform: translateX(0); }
.drawer-link{
  display: block;
  padding: .55rem .75rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
}
.drawer-link:hover,
.drawer-link.active{
  color: #fff;
  background: rgba(255,255,255,0.08);
}

@media (max-width: 576px){
  .navbar .btn, .navbar .badge{ font-size: .82rem; }
  .table tbody td{ font-size: .88rem; }
  .table thead th{ font-size: .82rem; }
}

/* Column sizing + actions */
.col-id{ width: 80px; }
.col-uf{ width: 72px; }
.col-actions{ width: 220px; white-space: nowrap; }
.table td.col-actions, .table th.col-actions{ text-align: right; }

.btn-icon{
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 12px;
}
.btn-icon.btn-sm{
  width: 34px;
  height: 34px;
  border-radius: 12px;
}
\n
.module-hidden{ display:none !important; }
.btn-group .btn.active{ background: rgba(13,110,253,0.22); border-color: rgba(13,110,253,0.55); color: #fff; }


/* Mantém a coluna de ações sempre visível, principalmente em Municípios */
#tbl th.col-actions,
#tbl td.col-actions{
  position: sticky;
  right: 0;
  z-index: 3;
  background: rgba(12,12,18,.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: -10px 0 18px rgba(0,0,0,.18);
}

#tbl thead th.col-actions{
  z-index: 4;
}

#tbl td.col-actions .d-inline-flex{
  justify-content: flex-end;
  width: 100%;
}


/* Responsividade extra das tabelas/planilhas e modais sem mudar o estilo base */
.table-responsive{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive::-webkit-scrollbar{ height: 12px; }
.table-responsive:hover::-webkit-scrollbar{ height: 20px; }
.table-responsive::-webkit-scrollbar-track{ background: rgba(255,255,255,0.04); border-radius: 8px; }
.table-responsive::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.16); border-radius: 8px; }
.table-responsive:hover::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.28); }
.table-responsive::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.40); }
.table-responsive{ scrollbar-color: rgba(255,255,255,0.16) rgba(255,255,255,0.04); scrollbar-width: thin; }
#tbl{
  min-width: 1100px;
}
@media (max-width: 991.98px){
  #tbl{ min-width: 980px; }
  .modal-dialog.modal-xl{ margin: .5rem; }
  .nav-pills{
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: .25rem;
  }
  .nav-pills::-webkit-scrollbar{ height: 6px; }
}


/* ===== Melhorias visuais dos modais / campos ===== */
.modal-dialog.modal-xl{
  max-width: min(1220px, 96vw);
}

.modal-content.glass{
  background: rgba(9, 12, 22, 0.94) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}

.modal-header{
  padding-bottom: .5rem;
}

.modal-body{
  padding-top: .5rem;
}

.modal .tab-content{
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 18px;
  margin-top: 10px;
}

.modal .form-label{
  display: block;
  margin-bottom: .45rem;
  font-size: .84rem;
  font-weight: 600;
  color: #dbe5f3;
  letter-spacing: .01em;
}

.modal .form-control,
.modal .form-select,
.modal textarea.form-control{
  background: rgba(255,255,255,0.12) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  color: #ffffff !important;
  min-height: 46px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.modal textarea.form-control{
  min-height: 120px;
  resize: vertical;
  padding-top: .85rem;
}

.modal .form-control::placeholder,
.modal textarea.form-control::placeholder{
  color: rgba(255,255,255,0.48) !important;
}

.modal .form-control:focus,
.modal .form-select:focus,
.modal textarea.form-control:focus{
  background: rgba(255,255,255,0.16) !important;
  border-color: rgba(13,110,253,0.72) !important;
  box-shadow: 0 0 0 .24rem rgba(13,110,253,0.18), inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

.modal .row.g-3 > [class*='col-']{
  margin-bottom: .15rem;
}

.modal .nav-pills{
  gap: .5rem !important;
}

.modal .nav-pills .nav-link{
  padding: .6rem .95rem;
  font-weight: 600;
}

.modal .p-3.rounded-4.bg-dark.bg-opacity-25{
  background: rgba(255,255,255,0.045) !important;
  border: 1px solid rgba(255,255,255,0.10);
}

.modal #previewBox,
.modal #notePreviewBox{
  line-height: 1.7;
  color: #edf2f9;
}

.modal .btn-primary{
  min-height: 46px;
  padding-inline: 1.2rem;
}

@media (max-width: 991.98px){
  .modal-dialog{
    margin: .45rem;
  }

  .modal .tab-content{
    padding: 14px;
  }

  .modal .form-control,
  .modal .form-select,
  .modal textarea.form-control{
    min-height: 44px;
  }
}

/* ===== Multi-select / Bulk actions ===== */
.col-check{ width: 40px; text-align: center; }
.col-check input[type="checkbox"]{
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  vertical-align: middle;
  transition: background .15s ease, border-color .15s ease;
}
.col-check input[type="checkbox"]:checked{
  background: #0d6efd;
  border-color: #0d6efd;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M10.28 2.28a.75.75 0 0 1 0 1.06l-5.25 5.25a.75.75 0 0 1-1.06 0L1.72 6.34a.75.75 0 1 1 1.06-1.06L4.5 7.01l4.72-4.73a.75.75 0 0 1 1.06 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.col-check input[type="checkbox"]:hover{
  border-color: rgba(13,110,253,0.55);
}

#tbl th.col-check,
#tbl td.col-check{
  position: sticky;
  left: 0;
  z-index: 3;
  background: rgba(12,12,18,.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#tbl thead th.col-check{ z-index: 4; }

#bulkActions .btn{
  border-radius: 12px;
  color: #fff;
}

/* ===== Form switches — tema escuro ===== */
.form-check.form-switch{
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: .6em;
  padding-left: 0;
}
.form-check.form-switch .form-check-input{
  float: none;
  margin-left: 0;
  margin-top: 0;
  background-color: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
  cursor: pointer;
  width: 2.8em;
  height: 1.4em;
  flex-shrink: 0;
}
.form-check.form-switch .form-check-input:focus{
  border-color: rgba(13,110,253,0.55);
  box-shadow: 0 0 0 .24rem rgba(13,110,253,0.18);
  background-color: rgba(255,255,255,0.12);
}
.form-check.form-switch .form-check-input:checked{
  background-color: #0d6efd;
  border-color: #0d6efd;
}
.form-check.form-switch .form-check-label{
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}
.modal .form-check.form-switch .form-check-input{
  min-height: auto;
}

/* ===== Dashboard cards ===== */
.dashboard-card{
  border: 1px solid rgba(255,255,255,0.10);
  transition: transform .12s ease, box-shadow .15s ease;
}
.dashboard-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.dashboard-card__label{
  color: rgba(243,244,246,0.70);
  letter-spacing: .02em;
  font-size: .82rem;
}
.dashboard-card__value{
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
}
.dashboard-card__total{
  font-size: 1rem;
  font-weight: 400;
  color: rgba(243,244,246,0.55);
}
.dashboard-card__pct{
  font-size: .85rem;
  font-weight: 600;
  margin-top: .2rem;
  color: rgba(243,244,246,0.75);
}
.dashboard-card--primary{
  background: rgba(13,110,253,0.12);
  border-color: rgba(13,110,253,0.28);
}
.dashboard-card--info{
  background: rgba(13,202,240,0.10);
  border-color: rgba(13,202,240,0.25);
}
.dashboard-card--success{
  background: rgba(25,135,84,0.12);
  border-color: rgba(25,135,84,0.28);
}
.dashboard-table-wrap{
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.16) rgba(255,255,255,0.04);
}
.dashboard-table-wrap::-webkit-scrollbar{ width: 6px; }
.dashboard-table-wrap::-webkit-scrollbar-track{ background: rgba(255,255,255,0.04); border-radius: 6px; }
.dashboard-table-wrap::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.16); border-radius: 6px; }
#tblDashboard thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12,12,18,.96);
  backdrop-filter: blur(10px);
  font-size: .82rem;
}
#tblDashboard tbody td{
  font-size: .85rem;
}

/* Status tooltip */
.tooltip.tooltip-status .tooltip-inner{
  max-width: 320px;
  text-align: left;
  padding: .65rem .85rem;
}
.tt-group{ margin-bottom: .5rem; }
.tt-group:last-child{ margin-bottom: 0; }
.tt-header{
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .55;
  margin-bottom: .3rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding-bottom: .2rem;
}
.tt-row{
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .15rem 0;
}
.tt-row .badge{ font-size: .7rem; min-width: 72px; text-align: center; }
.tt-desc{
  font-size: .78rem;
  color: rgba(255,255,255,.85);
}
