/* ==========================================================================
   SIGITR MODERN UI - Estilo Consolidado
   Framework: Bootstrap 5.3.3 + FontAwesome 6.5.1
   Identidade: Teal/Emerald Modern
   ========================================================================== */

:root {
    --primary-color: #17A2B8;
    --primary-dark: #138496;
    --secondary-color: #489A8E;
    --accent-color: #FF9800;
    --bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --card-shadow: 0 10px 40px rgba(23, 162, 184, 0.12);
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-height: 60px;
    --drawer-bg: #ffffff;
    --drawer-accent: #17A2B8;
}

/* ==========================================================================
   0. BASE — TIPOGRAFIA, BOTÕES, FORMS, CARDS, BREADCRUMB
   ========================================================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: #111827; margin-bottom: 0.45rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.9375rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.8125rem; }
p  { margin-bottom: 0.6rem; }

/* ---- Botões ---- */
.btn {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    letter-spacing: 0.01em;
    border-radius: 7px;
    line-height: 1.4;
    vertical-align: middle;
}
.btn-sm  { font-size: 0.75rem;  padding: 0.18rem 0.55rem; border-radius: 5px; }
.btn-lg  { font-size: 0.875rem; padding: 0.45rem 1rem;    border-radius: 8px; }
.btn i   { font-size: 0.8rem; }

/* ---- Forms ---- */
.form-control, .form-select {
    font-size: 0.875rem;
    padding: 0.32rem 0.65rem;
    border-radius: 7px;
}
.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}
.form-text { font-size: 0.775rem; }

/* ---- Cards ---- */
.card {
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.07);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card-header {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    border-radius: 10px 10px 0 0 !important;
}
.card-body  { padding: 1rem; font-size: 0.875rem; }
.card-footer { padding: 0.6rem 1rem; font-size: 0.8125rem; }

/* ---- Tabelas ---- */
.table { font-size: 0.8125rem; }
.table > thead > tr > th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    padding: 0.5rem 0.75rem;
    border-bottom-width: 1px;
}
.table > tbody > tr > td { padding: 0.42rem 0.75rem; vertical-align: middle; }

/* Sort links em cabeçalhos de tabela */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sort-link:hover { color: var(--primary-color); }
.sort-link .fa { font-size: 0.65rem; opacity: 0.55; }
.sort-link:hover .fa { opacity: 1; color: var(--primary-color); }

/* Tabela VTN */
.tb-vtn code { font-family: inherit; font-size: inherit; background: none; padding: 0; color: inherit; }
.tb-vtn tbody tr:hover { background: rgba(23,162,184,0.04); }

/* Tabela Registro de Ações */
.tb-logs tbody tr:hover { background: rgba(23,162,184,0.04); }

/* Células numéricas — mesma fonte do restante da tabela */
.td-num { font-family: inherit; }

/* ---- Badges ---- */
.badge { font-size: 0.72rem; font-weight: 600; }

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: rgba(23, 162, 184, 0.05);
    border: 1px solid rgba(23, 162, 184, 0.14);
    border-radius: 8px;
    padding: 0.42rem 0.9rem;
    margin-bottom: 0.85rem;
    font-size: 0.775rem;
}
.breadcrumb-item {
    display: flex;
    align-items: center;
    color: #6b7280;
}
.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}
.breadcrumb-item a:hover { color: var(--primary-dark); }
.breadcrumb-item:last-child,
.breadcrumb-item.active  { color: #1f2937; font-weight: 600; }
.breadcrumb-item:last-child a {
    color: #1f2937;
    font-weight: 600;
    pointer-events: none;
    cursor: default;
    text-decoration: none;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: rgba(23, 162, 184, 0.45);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.35rem;
}

/* ---- Paginação ---- */
.pagination { gap: 0.2rem; }
.page-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    border-color: rgba(23, 162, 184, 0.22);
    border-radius: 7px !important;
    padding: 0.3rem 0.65rem;
    transition: all 0.18s ease;
    line-height: 1.4;
}
.page-link:hover {
    background: rgba(23, 162, 184, 0.08);
    border-color: rgba(23, 162, 184, 0.42);
    color: var(--primary-dark);
}
.page-link:focus { box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.22); }
.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.35);
}
.page-item.disabled .page-link {
    color: #d1d5db;
    border-color: rgba(0,0,0,0.06);
    background: transparent;
}

/* ---- Alertas ---- */
.alert { font-size: 0.875rem; padding: 0.65rem 1rem; }
.alert-heading { font-size: 0.9rem; }

/* ---- Botões de mesma largura (SSD normas) ---- */
.btn-acao-ssd { min-width: 140px; text-align: center; }

/* ---- Espaçamento vertical entre campos e botões ---- */
/* Aplica automaticamente quando .btn segue um campo ou bloco de formulário */
/* Espaçamento vertical: qualquer botão irmão de campo de form recebe a mesma margem,
   garantindo alinhamento entre Enviar e Limpar/Cancelar lado a lado */
.form-group ~ .btn,
.form-group ~ a.btn,
.mb-3 ~ .btn,
.mb-3 ~ a.btn,
.row ~ .btn,
.row ~ a.btn {
    margin-top: 1rem;
    vertical-align: middle;
}
/* Coluna de row que contém somente um botão (sem label+field): alinha ao fundo
   para nivelar com o input das colunas vizinhas que têm label + campo */
.row > [class*="col-"]:has(> .btn:only-child),
.row > [class*="col-"]:has(> a.btn:only-child) {
    display: flex;
    align-items: flex-end;
    padding-bottom: 1px;
}

/* Classe explícita para wrapping de grupos de botões em forms */
.form-actions {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ==========================================================================
   1. NAVEGAÇÃO — NAVBAR DESKTOP
   ========================================================================== */

#main_navbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.97) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 4px 20px rgba(23, 162, 184, 0.08);
    border: none !important;
    padding: 0 !important;
}

/* Linha teal na base da navbar */
#main_navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #17A2B8 20%, #489A8E 50%, #17A2B8 80%, transparent 100%);
}

/* Container interno */
.nav-container {
    padding: 0 1.5rem;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

/* ---- Brand / Logo ---- */
.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    margin-right: 0.5rem;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.nav-brand:hover {
    background: rgba(23, 162, 184, 0.06);
    opacity: 0.85;
}

.nav-brand img {
    height: 38px;
    width: auto;
    display: block;
}

/* ---- Lista de links desktop ---- */
.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    gap: 0;
}

/* Item de link individual */
.nav-link-item {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.44rem 0.78rem;
    border-radius: 8px;
    font-size: 0.845rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    letter-spacing: 0.01em;
}

.nav-link-item i:not(.caret) {
    font-size: 0.82rem;
    color: #6b7280;
    transition: color 0.18s ease;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.nav-link-item .caret {
    font-size: 0.58rem;
    color: #b0b8c4;
    transition: transform 0.22s ease;
    margin-left: 0.05rem;
}

.nav-link-item:hover,
.nav-link-item.active {
    background: rgba(23, 162, 184, 0.09);
    color: #17A2B8;
}

.nav-link-item:hover i:not(.caret),
.nav-link-item.active i:not(.caret) {
    color: #17A2B8;
}

/* ---- Dropdown (CSS-only, ativado por hover) ---- */
.has-dropdown {
    position: relative;
}

/* Mostrar dropdown ao hover sobre o pai */
.has-dropdown:hover > .nav-dropdown,
.has-dropdown:focus-within > .nav-dropdown {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
    visibility: visible;
}

/* Girar caret ao abrir */
.has-dropdown:hover > .nav-link-item .caret,
.has-dropdown:hover > .nav-user-btn .caret {
    transform: rotate(180deg);
    color: #17A2B8;
}

/* Painel do dropdown */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 12px 40px rgba(0, 0, 0, 0.10),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 0.45rem;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 500;
}

/* Ponte invisível que cobre o gap de 8px entre o link e o painel,
   mantendo o :hover ativo enquanto o mouse transita entre os dois. */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.nav-dropdown-end {
    left: auto;
    right: 0;
}

/* Links e botões dentro do dropdown */
.nav-dropdown a,
.nav-dropdown button.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.58rem 0.85rem;
    border-radius: 9px;
    font-size: 0.845rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.nav-dropdown a i,
.nav-dropdown button.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.78rem;
    color: #9ca3af;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-dropdown a:hover,
.nav-dropdown button.dropdown-item:hover {
    background: rgba(23, 162, 184, 0.08);
    color: #17A2B8;
}

.nav-dropdown a:hover i,
.nav-dropdown button.dropdown-item:hover i {
    color: #17A2B8;
}

.nav-dropdown a.danger {
    color: #ef4444;
}

.nav-dropdown a.danger i {
    color: #ef4444;
}

.nav-dropdown a.danger:hover {
    background: rgba(239, 68, 68, 0.07);
    color: #dc2626;
}

.nav-dropdown a.danger:hover i {
    color: #dc2626;
}

/* Label de grupo dentro do dropdown */
.dropdown-group-label {
    display: block;
    padding: 0.45rem 0.85rem 0.15rem;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #9ca3af;
}

/* Divisor */
.dropdown-divider-line {
    margin: 0.35rem 0.5rem;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ---- Lado direito da navbar ---- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Pílula do município */
.nav-municipality {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.38rem 0.85rem;
    background: rgba(23, 162, 184, 0.07);
    border: 1.5px solid rgba(23, 162, 184, 0.2);
    border-radius: 20px;
    font-size: 0.775rem;
    font-weight: 600;
    color: #17A2B8;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease;
    max-width: 180px;
}

.nav-municipality i {
    font-size: 0.72rem;
    flex-shrink: 0;
}

.nav-municipality span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-municipality:hover {
    background: rgba(23, 162, 184, 0.14);
    border-color: rgba(23, 162, 184, 0.35);
    color: #138496;
}

/* Botão usuário */
.nav-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.28rem 0.6rem 0.28rem 0.28rem;
    background: none;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.845rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    line-height: 1;
}

.nav-user-btn:hover {
    border-color: rgba(23, 162, 184, 0.4);
    background: rgba(23, 162, 184, 0.05);
    color: #17A2B8;
}

.nav-user-btn .caret {
    font-size: 0.58rem;
    color: #b0b8c4;
    transition: transform 0.22s ease;
}

/* Avatar circular */
.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #17A2B8, #489A8E);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-username {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Botão hamburguer (somente mobile) ---- */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: none;
    border: 1.5px solid rgba(23, 162, 184, 0.28);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-hamburger span {
    display: block;
    width: 17px;
    height: 1.5px;
    background: #374151;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.nav-hamburger:hover {
    border-color: #17A2B8;
    background: rgba(23, 162, 184, 0.06);
}

/* Animação hamburguer → X */
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ==========================================================================
   2. DRAWER MOBILE
   ========================================================================== */

/* Overlay escurecido */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

/* Painel lateral */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 295px;
    max-width: 86vw;
    background: #ffffff;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: none;
}

/* Linha teal no topo do drawer */
.mobile-drawer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #17A2B8, #489A8E);
    z-index: 1;
}

.mobile-drawer.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.10);
}

/* Cabeçalho do drawer */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.2rem 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    flex-shrink: 0;
    background: #ffffff;
}

.drawer-logo img {
    height: 30px;
    width: auto;
}

.drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 0.85rem;
}

.drawer-close:hover {
    background: rgba(23, 162, 184, 0.1);
    color: var(--primary-color);
}

/* Localização */
.drawer-location {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem 1.2rem;
    background: rgba(23, 162, 184, 0.06);
    border-bottom: 1px solid rgba(23, 162, 184, 0.1);
    flex-shrink: 0;
}

.drawer-location > i {
    font-size: 0.9rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.drawer-location-name {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
}

.drawer-location-state {
    display: block;
    font-size: 0.69rem;
    color: #9ca3af;
    margin-top: 1px;
}

/* Scroll da navegação */
.drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem 0.6rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 162, 184, 0.15) transparent;
}

/* Item direto */
.drawer-item {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.6rem 0.85rem;
    border-radius: 9px;
    font-size: 0.845rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    margin-bottom: 0.1rem;
    transition: background 0.18s ease, color 0.18s ease;
}

/* Ícone quadrado */
.drawer-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(23, 162, 184, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: background 0.18s ease, color 0.18s ease;
}

.drawer-item:hover {
    background: rgba(23, 162, 184, 0.07);
    color: var(--primary-color);
}

.drawer-item:hover .drawer-item-icon {
    background: rgba(23, 162, 184, 0.15);
    color: var(--primary-dark);
}

.drawer-item.active {
    background: rgba(23, 162, 184, 0.1);
    color: var(--primary-color);
}

.drawer-item.active .drawer-item-icon {
    background: rgba(23, 162, 184, 0.2);
    color: var(--primary-dark);
}

/* Accordion */
.drawer-accordion {
    margin-bottom: 0.1rem;
}

.drawer-acc-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 9px;
    background: none;
    border: none;
    color: #374151;
    font-size: 0.845rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.18s ease, color 0.18s ease, border-radius 0.18s ease;
}

.drawer-acc-trigger > span {
    display: flex;
    align-items: center;
    gap: 0.72rem;
}

.drawer-acc-icon {
    font-size: 0.65rem;
    color: #9ca3af;
    transition: transform 0.24s ease, color 0.18s ease;
    flex-shrink: 0;
}

.drawer-acc-trigger:hover {
    background: rgba(23, 162, 184, 0.07);
    color: var(--primary-color);
}

.drawer-acc-trigger.is-open {
    color: var(--primary-color);
    background: rgba(23, 162, 184, 0.09);
    border-radius: 9px 9px 0 0;
}

.drawer-acc-trigger.is-open .drawer-acc-icon {
    transform: rotate(90deg);
    color: var(--primary-color);
}

/* Conteúdo do accordion: usa max-height para animar */
.drawer-acc-content {
    max-height: 0;
    overflow: hidden;
    background: rgba(23, 162, 184, 0.04);
    border-radius: 0 0 9px 9px;
    transition: max-height 0.3s ease;
}

.drawer-acc-content.is-open {
    max-height: 320px;
    padding-bottom: 0.3rem;
}

/* Sub-item dentro do accordion */
.drawer-sub-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.48rem 0.9rem 0.48rem 1.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
    border-radius: 7px;
    margin: 0.06rem 0.4rem;
}

.drawer-sub-item i {
    width: 13px;
    text-align: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.drawer-sub-item:hover {
    color: var(--primary-color);
    background: rgba(23, 162, 184, 0.08);
}

/* Label de grupo dentro do accordion */
.drawer-sub-group {
    display: block;
    padding: 0.5rem 1.5rem 0.12rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
}

/* Rodapé do drawer */
.drawer-footer {
    display: flex;
    padding: 0.6rem;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    gap: 0.4rem;
    background: #f9fafb;
    flex-shrink: 0;
}

.drawer-footer-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.58rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
    background: rgba(0, 0, 0, 0.03);
    border: none;
    cursor: pointer;
}

.drawer-footer-item:hover {
    background: rgba(23, 162, 184, 0.09);
    color: var(--primary-color);
}

.drawer-footer-item.danger { color: #ef4444; }

.drawer-footer-item.danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

/* ==========================================================================
   3. LAYOUT DO DASHBOARD
   ========================================================================== */
.dashboard-container {
    padding: 2rem 0;
    background: var(--bg-gradient);
    min-height: calc(100vh - var(--nav-height));
}

.dashboard-header {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(23, 162, 184, 0.1);
    position: relative;
    overflow: hidden;
}

.prefecture-crest {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    box-shadow: 0 10px 30px rgba(23, 162, 184, 0.3);
}

/* ==========================================================================
   4. COMPONENTES (CARDS & TABLES)
   ========================================================================== */
.stats-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition-base);
    height: 100%;
}

.stats-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 45px rgba(23, 162, 184, 0.15);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -1px;
}

.table-custom {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
}

.table-header-teal {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.table-header-teal th {
    border: none;
    padding: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.projection-card-teal {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 15px 40px rgba(23, 162, 184, 0.3);
}

/* ==========================================================================
   5. ANIMAÇÕES
   ========================================================================== */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.2); opacity: 0.7; }
}

/* ==========================================================================
   6. RESPONSIVIDADE
   ========================================================================== */

/* Tablet largo (1200–1399px): oculta label do município */
@media (max-width: 1399.98px) {
    .nav-municipality span { display: none; }
    .nav-municipality { padding: 0.38rem 0.6rem; max-width: none; }
}

/* Tablet (992–1199px): oculta nome do usuário e reduz gaps */
@media (max-width: 1199.98px) {
    .nav-username { display: none; }
    .nav-user-btn { padding: 0.28rem 0.38rem; }
    .nav-container { padding: 0 1rem; gap: 0.1rem; }
    .nav-link-item { padding: 0.42rem 0.65rem; font-size: 0.82rem; }
}

/* Mobile (<992px): oculta menu desktop, mostra hamburger */
@media (max-width: 991.98px) {
    .nav-links       { display: none; }
    .nav-municipality { display: none; }
    .nav-user-btn    { display: none; }
    .nav-hamburger   { display: flex; }
    .nav-container   { padding: 0 1rem; }
}

/* ==========================================================================
   7. SIGMT THEME — fundo diferenciado para o sistema SIG-MT
   ========================================================================== */

.sigmt-theme {
    background-color: #eff0f2;
}

.sigmt-theme .card {
    border-color: rgba(23, 162, 184, 0.14);
}

.sigmt-theme .breadcrumb {
    background: #fff;
    border-color: rgba(23, 162, 184, 0.2);
    box-shadow: 0 1px 5px rgba(23, 162, 184, 0.08);
}

.sigmt-theme .breadcrumb-item:last-child,
.sigmt-theme .breadcrumb-item.active { color: #1f2937; }

.sigmt-theme .navbar {
    background-color: #fff !important;
    border-bottom: 2px solid var(--secondary-color) !important;
}

/* Links dentro de tabelas de dados sigmt */
.tb-sigmt td a:not(.btn) {
    color: #138496;
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding-bottom: 1px;
    transition: color 0.15s ease;
}

.tb-sigmt td a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary-color);
    transition: width 0.22s ease;
}

.tb-sigmt td a:not(.btn):hover {
    color: var(--primary-color);
}

.tb-sigmt td a:not(.btn):hover::after {
    width: 100%;
}

/* ==========================================================================
   8. UTILITÁRIOS — MIGRADOS DO LEGADO
   ========================================================================== */

/* Status */
.ok  { color: #22c55e; }
.no  { color: #ef4444; }

/* Brasão da prefeitura */
img.brasao { width: auto; max-width: 80px; max-height: 80px; height: auto; object-fit: contain; }

/* Formulários — erros */
.errorlist { list-style: none; margin: 0; padding: 0; }
.errorlist li { color: #ef4444; font-size: 0.775rem; margin-top: 0.2rem; }
.help-block { display: block; margin-top: 4px; font-size: 0.775rem; color: #ef4444; }

/* Tabelas compactas */
.tb-menor td, .tb-menor td a { font-size: 0.775rem !important; padding: 5px !important; }
.th-menor { font-size: 0.72rem !important; }

/* Misc */
.mini-font    { font-size: 0.82em; }
.unchecked    { font-size: 4rem; color: #ef4444; }
.checked      { font-size: 4rem; color: #22c55e; }
.lbl-rel      { padding-right: 10px; }
.sp           { padding-left: 13px; color: #a4a4a4; }
.search-error { font-weight: 600; display: none; }
.form-mapa    { padding: 5px; }

/* Botões do mapa — inline, alinhados na base dos campos */
.btn-mapa {
    display: inline-flex;
    align-items: center;
    align-self: flex-end;
    gap: 0.45rem;
    padding-bottom: 1px;
}

/* Toggle de accordion no card-header */
.card-header a[data-bs-toggle="collapse"] {
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.18s ease;
}
.card-header a[data-bs-toggle="collapse"]:hover { color: var(--primary-color); }
.card-header a[data-bs-toggle="collapse"]::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.6rem;
    color: #9ca3af;
    transition: transform 0.25s ease;
}
.card-header a[data-bs-toggle="collapse"]:not(.collapsed)::after {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* Spinner de carregamento */
#spinner {
    width: 45px;
    height: 45px;
    margin-top: 20px;
    margin-left: 30px;
    vertical-align: middle;
    display: none;
}

/* Card que contém o mapa — sem overflow para respeitar border-radius */
.card-map {
    overflow: hidden;
}

/* ==========================================================================
   9. LEAFLET MAP CONTROLS — harmonizados com paleta teal
   ========================================================================== */

/* Barra base (zoom, fullscreen, zoomhome…) */
.leaflet-bar {
    border-radius: 8px !important;
    border: 1px solid rgba(23, 162, 184, 0.22) !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08) !important;
    overflow: hidden;
}

/* Botões da barra */
.leaflet-bar a,
.leaflet-bar a:hover {
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    color: #374151 !important;
    background-color: #fff !important;
    border-bottom-color: rgba(23, 162, 184, 0.1) !important;
    font-size: 13px !important;
}

.leaflet-bar a:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

.leaflet-bar a.leaflet-disabled {
    color: #d1d5db !important;
    background-color: #f9fafb !important;
    cursor: not-allowed;
}

/* Zoom in/out — ajusta font-size para o novo tamanho */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    font-size: 14px !important;
    line-height: 26px !important;
}

/* Touch (mantém proporção relativa ao menor tamanho) */
.leaflet-touch .leaflet-bar a {
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    font-size: 14px !important;
}
.leaflet-touch .leaflet-control-zoom-in,
.leaflet-touch .leaflet-control-zoom-out { font-size: 16px !important; }

/* ZoomHome — fonte menor e mais refinada */
.leaflet-control-zoomhome a {
    font: bold 12px 'Inter', 'Lucida Console', monospace !important;
}
a.leaflet-control-zoomhome-in,
a.leaflet-control-zoomhome-out { font-size: 1.1em !important; }

/* Painel de camadas */
.leaflet-control-layers {
    border: 1px solid rgba(23, 162, 184, 0.22) !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.78rem !important;
}
.leaflet-control-layers-expanded {
    max-height: calc(100vh - 120px) !important;
    overflow: hidden !important;
}
.leaflet-control-layers-list {
    max-height: calc(100vh - 160px) !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
}
.leaflet-control-layers-toggle {
    width: 45px !important;
    height: 35px !important;
    background-size: 28px 28px !important;
}
.leaflet-retina .leaflet-control-layers-toggle {
    background-size: 28px 28px !important;
}

/* Medição */
.leaflet-control-measure {
    border: 1px solid rgba(23, 162, 184, 0.22) !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.78rem !important;
}
.leaflet-control-measure a.start,
.leaflet-control-measure a.cancel,
.leaflet-control-measure a.finish { color: var(--primary-color) !important; }

/* Controle de coordenadas "Ir para as coordenadas"
   Mantém tamanho original — apenas harmoniza cores e tipografia */
.leaflet-control-coordinates {
    background: rgba(255,255,255,0.96) !important;
    border: 1px solid rgba(23, 162, 184, 0.22) !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.775rem !important;
    color: #374151 !important;
    padding: 4px 8px !important;
}

/* Inputs do form "Ir para as coordenadas" */
.leaflet-control-coordinates .uiElement {
    margin: 4px 2px !important;
}
.leaflet-control-coordinates .uiElement input {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.775rem !important;
    color: #374151 !important;
    border: 1px solid rgba(23, 162, 184, 0.3) !important;
    border-radius: 5px !important;
    padding: 3px 6px !important;
    background: #fff !important;
    outline: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.leaflet-control-coordinates .uiElement input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.15) !important;
}
.leaflet-control-coordinates .uiElement .labelFirst {
    color: #6b7280 !important;
    font-size: 0.72rem !important;
    font-weight: 500 !important;
}

/* Popup de resultado do mapa */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.8rem !important;
    color: #374151 !important;
}
.leaflet-popup-tip { box-shadow: 0 2px 6px rgba(0,0,0,0.08) !important; }

/* Mapa (Leaflet) */
#mapid {
    width: 100%;
    height: calc(100vh - 290px);
    min-height: 420px;
    padding: 0;
    border-radius: 0 0 10px 10px;
}
/* Legenda Leaflet — toggle hover */
.info.legend {
    padding: 0;
    background: #fff;
    border: 1px solid rgba(23, 162, 184, 0.22);
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    font-family: 'Inter', sans-serif;
    width: fit-content;
    position: relative;
}

.legend-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.775rem;
    font-weight: 600;
    color: #374151;
    cursor: default;
    white-space: nowrap;
    user-select: none;
}

.legend-toggle .fa {
    font-size: 0.75rem;
    color: #374151;
}

.legend-content {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid rgba(23, 162, 184, 0.22);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.22s ease, padding 0.22s ease, opacity 0.15s ease;
    min-width: 180px;
}

.info.legend:hover .legend-content {
    max-height: 520px;
    overflow-y: auto;
    padding: 6px 10px 10px;
    opacity: 1;
    pointer-events: auto;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #374151;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    white-space: nowrap;
}

.legend-item:last-child { border-bottom: none; }

.legend-item img {
    display: block;
}

.legenda { display: block; }
.rd-1-ar { display: block; float: left; clear: both; }
.rd-1-ar                      { display: block; float: left; clear: both; }
.leaflet-container            { cursor: crosshair !important; }
.leaflet-control-layers label { display: block; font-size: 0.72rem; font-family: 'Inter', sans-serif; color: #374151; }
.leaflet-popup-content-wrapper { font-family: 'Inter', sans-serif !important; font-size: 0.775rem !important; }
.leaflet-popup-content-wrapper ul { list-style-type: none; margin: 0; padding: 0; }
.leaflet-popup-content-wrapper li { color: #6e6e6e; }
.leaflet-popup-content-wrapper span { font-weight: 600; color: #1f2937; }

/* Legendas de camadas CAR/INCRA */
.municipio_selecionado i  { border: 2px solid #FF9933; }
.municipios i             { border: 2px solid #e4e5e6; }
.imoveis_rurais_selecao i { background: #eba098; border: 2px solid #f60009; }
.imoveis_rurais i         { background: #86fca0; border: 2px solid #86fca0; }
.car_selecao i            { background: #ff99ff; border: 2px solid #b300b3; }
.car_entorno i            { background: #b3b3cc; border: 2px solid #5c5c8a; }
.areas_indigenas i        { background: #006666; border: 2px solid #000; }
.assentamentos_brasil i   { background: #ffcc00; border: 2px solid #000; }
.hidro i                  { background: #99ccff; border: 2px solid #00f; }
.car_app i                { background: #66ffcc; border: 2px solid #000; }
.reserva_legal i          { background: #b37700; border: 2px solid #d9d9d9; }
.veg_nativa i             { background: #ccffeb; border: 2px solid #b3ffe0; }
.assentamentos i          { background: #ffcc00; border: 2px solid #b38f00; }
.quilombolas i            { background: #99ccff; border: 2px solid #004080; }
.rppn i                   { background: #cfcfcf; border: 2px solid #000; }
.area_consolidada i       { background: #6699ff; border: 2px solid #666699; }
.nascentes i              { background: #fff;    border: 2px solid #00bfff; }
.nao i                    { background: #1f78b4; border: 2px solid #0c3873; }
.sim i                    { background: #ff0;    border: 2px solid #f0d731; }
.entorno_nao i            { background: #74a9cf; border: 2px solid #e7e1ef; }
.entorno_sim i            { background: #ff0;    border: 2px solid #000; }

/* Select2 */
.select2-container--bootstrap4 .select2-results__option { padding: .75rem .375rem; font-size: .875rem !important; }
.select2-container--bootstrap4 .select2-selection        { font-size: .875rem !important; }
.select2-selection                                        { height: 34px !important; }
