/* ============================================================
   TEMA MERCOSUL — Sistema de Gestão de Emplacadoras
   Paleta: Azul #003DA5 | Amarelo #FFD700 | Verde #1a9a4e | Branco
   Autor: Gerado para uso em templates/admin/base_site.html
   Injetar via {% block extrahead %}
   ============================================================ */

/* -----------------------------------------------
   0. GOOGLE FONTS — Tipografia Profissional
   ----------------------------------------------- */

/* -----------------------------------------------
   1. CSS VARIABLES (sobrescreve o Django Admin)
   ----------------------------------------------- */
html[data-theme="light"],
html:not([data-theme]) {
    /* Cores primárias */
    --primary: #003DA5;
    --secondary: #003DA5;
    --accent: #FFD700;
    --green: #1a9a4e;
    --red-danger: #dc3545;

    /* Header */
    --header-bg: #003DA5;
    --header-color: #FFFFFF;
    --header-link-color: #FFFFFF;
    --header-branding-color: #FFD700;

    /* Breadcrumbs */
    --breadcrumbs-fg: #FFFFFF;
    --breadcrumbs-bg: #002B75;
    --breadcrumbs-link-fg: #FFD700;

    /* Sidebar */
    --sidebar-background: #001F54;

    /* Botões */
    --button-bg: #003DA5;
    --button-fg: #FFFFFF;
    --button-hover-bg: #002B75;
    --default-button-bg: #003DA5;
    --default-button-hover-bg: #002B75;

    /* Body */
    --body-bg: #F4F6FA;
    --body-fg: #1a1a2e;
    --body-quiet-color: #5a6178;
    --body-loud-color: #003DA5;

    /* Links */
    --link-fg: #003DA5;
    --link-hover-color: #002B75;
    --link-selected-fg: #003DA5;

    /* Bordas e sombras */
    --hairline-color: #dee2e8;
    --border-color: #dee2e8;

    /* Tipografia */
    --font-family-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-family-monospace: 'JetBrains Mono', 'Fira Code', monospace;
}

/* -----------------------------------------------
   2. RESET DE TIPOGRAFIA GLOBAL
   ----------------------------------------------- */
body,
body.popup,
#container,
#content,
.module,
.form-row,
p, li, td, th, label, input, select, textarea, a,
.help, .helptext,
div, span {
    font-family: var(--font-family-primary) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code, pre, .monospace,
input[type="text"].vDateField,
input[type="text"].vTimeField {
    font-family: var(--font-family-monospace) !important;
}

body {
    background: var(--body-bg) !important;
    color: var(--body-fg) !important;
    font-size: 14px;
    line-height: 1.6;
}

/* -----------------------------------------------
   3. HEADER — Faixa azul com placa Mercosul
   ----------------------------------------------- */

#header::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #FFD700, #003DA5, #1a9a4e, #003DA5, #FFD700);
}

/* Header com logo à esquerda + placa centralizada */
#header {
    background: linear-gradient(135deg, #003DA5 0%, #002B75 100%) !important;
    color: #FFFFFF !important;
    padding: 8px 24px !important;
    border-bottom: 4px solid #FFD700 !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
}

#branding {
    flex: 1;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
}

/* Logo à esquerda — posição absoluta pra não atrapalhar centralização */
.branding-logo {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    line-height: 1;
}

#branding h1 {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* -----------------------------------------------
   PLACA MERCOSUL — Tamanho reduzido
   ----------------------------------------------- */
.placa-mercosul {
    display: inline-flex;
    flex-direction: column;
    width: 210px;
    border: 2.5px solid #1a1a2e;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    position: relative;
    background: #FFFFFF;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.placa-mercosul:hover {
    transform: scale(1.03);
}

/* Faixa azul superior */
.placa-topo {
    background: linear-gradient(135deg, #003DA5, #002B75);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 8px;
    height: 16px;
    position: relative;
}

.placa-mercosul-label {
    font-size: 5.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.placa-brasil {
    font-size: 7px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.placa-bandeira {
    font-size: 11px;
    line-height: 1;
}

/* Corpo da placa — nome do sistema */
.placa-corpo {
    background: #FFFFFF;
    padding: 3px 10px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 28px;
}

.placa-br {
    position: absolute;
    left: 6px;
    bottom: 3px;
    background: #003DA5;
    color: #FFFFFF;
    font-size: 5.5px;
    font-weight: 800;
    padding: 1px 2px;
    border-radius: 2px;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.placa-nome {
    font-size: 16px;
    font-weight: 900;
    color: #1a1a2e;
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.1;
    text-transform: uppercase;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.placa-nome a,
.placa-nome a:link,
.placa-nome a:visited,
#site-name a,
#site-name a:link,
#site-name a:visited {
    color: #1a1a2e !important;
    text-decoration: none !important;
    font-weight: 900 !important;
    font-size: 16px !important;
    letter-spacing: 1px !important;
    text-shadow: none !important;
}

.placa-nome a:hover,
#site-name a:hover {
    color: #003DA5 !important;
}

/* User tools — posicionar à direita */
#user-tools {
    position: absolute !important;
    right: 24px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}

/* Responsivo — placa menor no mobile */
@media (max-width: 767px) {
    .placa-mercosul {
        width: 160px;
    }
    .placa-nome, .placa-nome a {
        font-size: 11px !important;
        letter-spacing: 0.3px !important;
    }
    .placa-topo {
        height: 14px;
        padding: 2px 6px;
    }
    .placa-corpo {
        padding: 2px 6px 4px;
        min-height: 22px;
    }
    .branding-logo {
        position: relative !important;
        left: auto !important;
        transform: none !important;
    }
    .branding-logo img {
        height: 28px !important;
    }
    #branding {
        gap: 10px !important;
    }
    #user-tools {
        position: relative !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
    }
}

#user-tools a,
#user-tools a:link,
#user-tools a:visited {
    color: #FFD700 !important;
    font-weight: 600 !important;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

#user-tools a:hover {
    color: #FFFFFF !important;
    border-bottom-color: #FFD700;
}

/* -----------------------------------------------
   4. BREADCRUMBS
   ----------------------------------------------- */
div.breadcrumbs {
    background: #002B75 !important;
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 10px 24px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

div.breadcrumbs a,
div.breadcrumbs a:link,
div.breadcrumbs a:visited {
    color: #FFD700 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

div.breadcrumbs a:hover {
    color: #FFFFFF !important;
    text-decoration: underline !important;
}

/* -----------------------------------------------
   5. SIDEBAR — Azul profundo com hover amarelo
   ----------------------------------------------- */
#nav-sidebar {
    background: #001F54 !important;
    border-right: 1px solid rgba(255, 215, 0, 0.1) !important;
    scrollbar-width: thin;
    scrollbar-color: #003DA5 #001F54;
}

/* Caption = título da seção (AUTENTICAÇÃO, GESTÃO) — fica uppercase */
#nav-sidebar .module caption {
    background: transparent !important;
    color: #FFD700 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    padding: 14px 16px 8px !important;
    border: none !important;
}

/* TH e TD = links de modelo e "Adicionar" — NÃO uppercase */
#nav-sidebar .module table,
#nav-sidebar .module tbody,
#nav-sidebar .module tr,
#nav-sidebar .module th,
#nav-sidebar .module td {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    text-transform: none !important;
}

/* Links de modelo na sidebar (estão dentro de <th>, não <td>) */
#nav-sidebar .module th a,
#nav-sidebar .module th a:link,
#nav-sidebar .module th a:visited,
#nav-sidebar .module td a,
#nav-sidebar .module td a:link,
#nav-sidebar .module td a:visited {
    color: rgba(255, 255, 255, 0.75) !important;
    padding: 9px 16px 9px 20px !important;
    display: block !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    text-transform: none !important;
    transition: all 0.2s ease !important;
    border-left: 3px solid transparent !important;
}

#nav-sidebar .module th a:hover,
#nav-sidebar .module th a:focus,
#nav-sidebar .module td a:hover,
#nav-sidebar .module td a:focus {
    color: #FFFFFF !important;
    background: rgba(255, 215, 0, 0.08) !important;
    border-left-color: #FFD700 !important;
}

#nav-sidebar .module th a.current-model,
#nav-sidebar .module td a.current-model,
#nav-sidebar .current-model {
    color: #FFD700 !important;
    background: rgba(255, 215, 0, 0.12) !important;
    border-left-color: #FFD700 !important;
    font-weight: 700 !important;
}

/* Botão + Adicionar na sidebar */
#nav-sidebar .module td a.addlink,
#nav-sidebar .module th a.addlink {
    color: #1a9a4e !important;
    font-size: 12px !important;
    padding: 4px 16px !important;
}

#nav-sidebar .module td a.addlink:hover,
#nav-sidebar .module th a.addlink:hover {
    color: #FFD700 !important;
}

/* Toggle sidebar button */
#toggle-nav-sidebar {
    background: #002B75 !important;
    color: #FFD700 !important;
    border: none !important;
    width: 24px !important;
    transition: all 0.2s ease !important;
}

#toggle-nav-sidebar:hover {
    background: #003DA5 !important;
    color: #FFFFFF !important;
}

/* Filtro de busca na sidebar */
#nav-filter {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 215, 0, 0.2) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    margin: 8px 12px !important;
    font-size: 13px !important;
}

#nav-filter::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

#nav-filter:focus {
    border-color: #FFD700 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15) !important;
}

/* -----------------------------------------------
   6. ÁREA DE CONTEÚDO
   ----------------------------------------------- */
#content {
    padding: 24px 32px !important;
}

#content h1 {
    color: #003DA5 !important;
    font-weight: 800 !important;
    font-size: 26px !important;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

#content h2 {
    color: #003DA5 !important;
    font-weight: 700 !important;
    font-size: 18px !important;
}

/* -----------------------------------------------
   7. MÓDULOS / CARDS
   ----------------------------------------------- */
.module {
    border: 1px solid #dee2e8 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
    margin-bottom: 20px !important;
    background: #FFFFFF !important;
}

/* Sidebar modules herdam o fundo escuro — NÃO branco */
#nav-sidebar .module {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
}

.module > h2,

.module > caption,

.module > table > caption,

.inline-group h2 {

    background: linear-gradient(135deg, #003DA5 0%, #002B75 100%) !important;

    color: #FFFFFF !important;

    font-size: 13px !important;

    font-weight: 700 !important;

    letter-spacing: 0.5px !important;

    text-transform: uppercase !important;

    padding: 12px 18px !important;

    border: none !important;

}

/* -----------------------------------------------
   8. TABELAS — Cabeçalho azul, linhas zebra
   ----------------------------------------------- */
#result_list table,
#changelist table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
}

#result_list table thead th,
#changelist table thead th {
    background: linear-gradient(135deg, #003DA5, #002B75) !important;
    color: #FFFFFF !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    padding: 12px 14px !important;
    border: none !important;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

#result_list table thead th a:link,
#result_list table thead th a:visited,
#changelist table thead th a:link,
#changelist table thead th a:visited {
    color: #FFD700 !important;
    text-decoration: none !important;
}

#result_list table thead th a:hover,
#changelist table thead th a:hover {
    color: #FFFFFF !important;
}

/* Seta de ordenação */
table thead th.sorted {
    background: #002B75 !important;
}

table thead th .text span.arrow-up,
table thead th .text span.arrow-down {
    color: #FFD700 !important;
}

/* Linhas */
#result_list table tbody tr,
#changelist table tbody tr {
    transition: background 0.15s ease;
}

#result_list table tbody tr:nth-child(even),
#changelist table tbody tr:nth-child(even),
#changelist table tbody tr.row2 {
    background: #F8FAFD !important;
}

#result_list table tbody tr:nth-child(odd),
#changelist table tbody tr:nth-child(odd),
#changelist table tbody tr.row1 {
    background: #FFFFFF !important;
}

#result_list table tbody tr:hover,
#changelist table tbody tr:hover {
    background: rgba(0, 61, 165, 0.04) !important;
}

#result_list table tbody td,
#changelist table tbody td {
    padding: 10px 14px !important;
    font-size: 13.5px !important;
    border-bottom: 1px solid #EEF1F6 !important;
    color: #2c3e50 !important;
}

#result_list table tbody td a,
#changelist table tbody td a,
#result_list table tbody th a,
#changelist table tbody th a,
#result_list a,
#changelist .results a {
    color: #003DA5 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

#result_list table tbody td a:hover,
#changelist table tbody td a:hover,
#result_list a:hover,
#changelist .results a:hover {
    color: #002B75 !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

/* Checkbox da tabela */
#result_list input[type="checkbox"],
#changelist input[type="checkbox"] {
    accent-color: #003DA5;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* -----------------------------------------------
   9. BOTÕES — Hierarquia visual clara
   ----------------------------------------------- */

/* Botão primário (salvar, etc) */
input[type="submit"],
button[type="submit"],
.submit-row input[type="submit"],
a.button,
.button {
    background: linear-gradient(135deg, #003DA5, #002B75) !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 22px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(0, 61, 165, 0.25) !important;
    text-transform: none !important;
    letter-spacing: 0.2px;
}

input[type="submit"]:hover,
button[type="submit"]:hover,
.submit-row input[type="submit"]:hover,
a.button:hover,
.button:hover {
    background: linear-gradient(135deg, #002B75, #001F54) !important;
    box-shadow: 0 4px 12px rgba(0, 61, 165, 0.35) !important;
    transform: translateY(-1px);
}

input[type="submit"]:active,
button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 61, 165, 0.2) !important;
}

/* Botão "Salvar e continuar" e "Salvar e adicionar" */
.submit-row input[name="_continue"],
.submit-row input[name="_addanother"] {
    background: linear-gradient(135deg, #1a9a4e, #158a42) !important;
    box-shadow: 0 2px 6px rgba(26, 154, 78, 0.25) !important;
}

.submit-row input[name="_continue"]:hover,
.submit-row input[name="_addanother"]:hover {
    background: linear-gradient(135deg, #158a42, #117a38) !important;
    box-shadow: 0 4px 12px rgba(26, 154, 78, 0.35) !important;
}

/* Botão Deletar / Danger */
.deletelink,
.submit-row a.deletelink,
input[type="submit"].default[name="action"][value*="delete"] {
    background: #dc3545 !important;
    color: #FFFFFF !important;
    border-radius: 8px !important;
    padding: 10px 22px !important;
    font-weight: 700 !important;
}

.deletelink:hover,
.submit-row a.deletelink:hover {
    background: #c82333 !important;
    color: #FFFFFF !important;
}

/* Submit row container */
.submit-row {
    background: #F4F6FA !important;
    border: 1px solid #dee2e8 !important;
    border-radius: 10px !important;
    padding: 16px 20px !important;
    margin: 20px 0 !important;
}

/* -----------------------------------------------
   10. FILTRO LATERAL (changelist)
   ----------------------------------------------- */
#changelist-filter {
    background: #FFFFFF !important;
    border: 1px solid #dee2e8 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#changelist-filter h2 {
    background: linear-gradient(135deg, #003DA5, #002B75) !important;
    color: #FFFFFF !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    padding: 14px 18px !important;
    margin: 0 !important;
}

#changelist-filter h3 {
    color: #003DA5 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 14px 18px 6px !important;
    margin: 0 !important;
    border-top: 1px solid #EEF1F6;
}

#changelist-filter ul {
    padding: 0 18px 10px !important;
    margin: 0 !important;
}

#changelist-filter li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#changelist-filter li a {
    display: block !important;
    padding: 6px 10px !important;
    color: #5a6178 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
}

#changelist-filter li a:hover {
    background: rgba(0, 61, 165, 0.06) !important;
    color: #003DA5 !important;
}

#changelist-filter li.selected a {
    background: rgba(0, 61, 165, 0.1) !important;
    color: #003DA5 !important;
    font-weight: 700 !important;
}

/* -----------------------------------------------
   11. ALERTAS E MENSAGENS
   ----------------------------------------------- */
.messagelist li {
    border-radius: 8px !important;
    padding: 12px 18px !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    margin: 8px 0 !important;
}

.messagelist li.success {
    background: #d4edda !important;
    color: #155724 !important;
    border: 1px solid #c3e6cb !important;
}

.messagelist li.warning {
    background: #fff3cd !important;
    color: #856404 !important;
    border: 1px solid #ffeeba !important;
}

.messagelist li.error {
    background: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb !important;
}

.messagelist li.info {
    background: #d1ecf1 !important;
    color: #0c5460 !important;
    border: 1px solid #bee5eb !important;
}

/* Alertas customizados do sistema */
.alerta-caixa-entrada,
.alerta-nao-entregues,
.alerta-conferencia {
    border-radius: 8px !important;
    padding: 10px 16px !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
}

/* -----------------------------------------------
   12. FORMULÁRIOS
   ----------------------------------------------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="search"],
textarea {
    border: 1.5px solid #dee2e8 !important;
    border-radius: 8px !important;
    padding: 9px 14px !important;
    font-size: 14px !important;
    background: #FFFFFF !important;
    color: #1a1a2e !important;
    transition: all 0.2s ease !important;
}

/* Selects globais — padding normal para formulários */
select {
    border: 1.5px solid #dee2e8 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    background: #FFFFFF !important;
    color: #1a1a2e !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    line-height: 1.4 !important;
}

select option {
    color: #1a1a2e !important;
    background: #FFFFFF !important;
    padding: 4px 8px !important;
}

/* Selects DENTRO do changelist (Status, Forma Pagamento) — compactos */
#changelist select,
#result_list select,
#changelist-form select {
    padding: 5px 8px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    border-color: #003DA5 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(0, 61, 165, 0.12) !important;
}

/* Related widget wrappers (selects com lupa/+) */
    min-width: 200px !important;
}

.form-row {
    padding: 12px 14px !important;
    border-bottom: 1px solid #F4F6FA !important;
}

.form-row:hover {
    background: #FAFBFD;
}

label {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    font-size: 13px !important;
}

.help, .helptext {
    color: #7f8c9b !important;
    font-size: 12px !important;
}

fieldset {
    border: 1px solid #dee2e8 !important;
    border-radius: 10px !important;
    margin: 16px 0 !important;
}

/* -----------------------------------------------
   13. PAGINAÇÃO
   ----------------------------------------------- */
.paginator {
    background: #FFFFFF !important;
    border: 1px solid #dee2e8 !important;
    border-radius: 8px !important;
    padding: 10px 18px !important;
    font-size: 13px !important;
    color: #5a6178 !important;
}

.paginator a:link,
.paginator a:visited {
    color: #003DA5 !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    text-decoration: none !important;
}

.paginator a:hover {
    background: rgba(0, 61, 165, 0.08) !important;
}

/* -----------------------------------------------
   14. RELATED WIDGET / LUPA / CALENDÁRIO
   ----------------------------------------------- */
    color: #003DA5 !important;
}

.calendar-shortcuts a,
.timezonewarning a,
.calendarbox .calendarnav a {
    color: #003DA5 !important;
}

.calendar td a:hover,
.timelist a:hover {
    background: #003DA5 !important;
    color: #FFFFFF !important;
}

.calendar td.today a {
    background: #FFD700 !important;
    color: #003DA5 !important;
    font-weight: 700 !important;
}

/* -----------------------------------------------
   15. OBJECT-TOOLS (Botões "Adicionar", "Histórico")
   ----------------------------------------------- */
.object-tools li a,
.object-tools li a:link,
.object-tools li a:visited {
    background: linear-gradient(135deg, #003DA5, #002B75) !important;
    color: #FFFFFF !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 6px rgba(0, 61, 165, 0.2);
}

.object-tools li a:hover {
    background: linear-gradient(135deg, #002B75, #001F54) !important;
    box-shadow: 0 4px 10px rgba(0, 61, 165, 0.3);
    transform: translateY(-1px);
}

.object-tools li a.addlink {
    background: linear-gradient(135deg, #1a9a4e, #158a42) !important;
    box-shadow: 0 2px 6px rgba(26, 154, 78, 0.2);
}

.object-tools li a.addlink:hover {
    background: linear-gradient(135deg, #158a42, #117a38) !important;
}

/* -----------------------------------------------
   16. ACTIONS BAR (barra de ações em massa)
   ----------------------------------------------- */
.actions {
    background: #F4F6FA !important;
    border: 1px solid #dee2e8 !important;
    border-radius: 8px !important;
    padding: 10px 16px !important;
    margin-bottom: 16px !important;
}

.actions select {
    border-radius: 8px !important;
    border: 1.5px solid #dee2e8 !important;
    padding: 8px 12px !important;
}

.actions button[type="submit"] {
    font-size: 12.5px !important;
    padding: 8px 18px !important;
}

/* -----------------------------------------------
   17. CHANGELIST TOOLBAR (busca + filtros período)
   ----------------------------------------------- */
#toolbar {
    background: #FFFFFF !important;
    border: 1px solid #dee2e8 !important;
    border-radius: 10px !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

#searchbar {
    border: 1.5px solid #dee2e8 !important;
    border-radius: 8px !important;
    padding: 9px 14px !important;
    font-size: 14px !important;
    min-width: 280px;
}

#searchbar:focus {
    border-color: #003DA5 !important;
    box-shadow: 0 0 0 3px rgba(0, 61, 165, 0.12) !important;
}

/* -----------------------------------------------
   18. INLINE GROUPS (Tabular / Stacked)
   ----------------------------------------------- */
.inline-group .tabular td,
.inline-group .tabular th {
    padding: 10px 12px !important;
    font-size: 13px !important;
}

.inline-group .tabular thead th {
    background: #EEF1F6 !important;
    color: #003DA5 !important;
    font-weight: 700 !important;
    font-size: 11.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
}

.inline-related h3 {
    background: #F4F6FA !important;
    color: #003DA5 !important;
    border: 1px solid #dee2e8 !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 10px 16px !important;
    font-weight: 700 !important;
}

/* -----------------------------------------------
   19. DASHBOARD HOME (index.html)
   ----------------------------------------------- */
#content .app-label,
#content caption a:link,
#content caption a:visited {
    color: #003DA5 !important;
    font-weight: 800 !important;
}

/* Dashboard home — cabeçalho de tabela */
#content .module table thead th,
#content .module > table > caption {
    background: transparent !important;
    color: #003DA5 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    padding: 10px 14px !important;
    border-bottom: 2px solid #003DA5 !important;
}

/* Changelist body — th (field-placa etc.) NÃO pode ter borda azul */
#result_list table tbody th,
#changelist table tbody th,
#content .module table tbody th {
    border-bottom: 1px solid #EEF1F6 !important;
    background: transparent !important;
    font-weight: normal !important;
    text-transform: none !important;
    font-size: 13.5px !important;
    padding: 10px 14px !important;
    color: #2c3e50 !important;
}

#content .module table td a:link,
#content .module table td a:visited {
    color: #003DA5 !important;
    font-weight: 600 !important;
}

#content .module table td a:hover {
    color: #002B75 !important;
}

/* -----------------------------------------------
   20. BOTÕES CUSTOMIZADOS DO SISTEMA
   (Imprimir OS, Central de Cobranças, etc.)
   ----------------------------------------------- */

/* Botão Verde (Imprimir OS, Gerar Recibo) */
.btn-success,
button.btn-success,
a.btn-success {
    background: linear-gradient(135deg, #1a9a4e, #158a42) !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(26, 154, 78, 0.25) !important;
    font-weight: 700 !important;
    transition: all 0.2s ease !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #158a42, #117a38) !important;
    box-shadow: 0 4px 10px rgba(26, 154, 78, 0.35) !important;
    transform: translateY(-1px);
}

/* Botão Primário (Central, Bradesco) */
.btn-primary,
button.btn-primary,
a.btn-primary {
    background: linear-gradient(135deg, #003DA5, #002B75) !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0, 61, 165, 0.25) !important;
    font-weight: 700 !important;
    transition: all 0.2s ease !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #002B75, #001F54) !important;
    box-shadow: 0 4px 10px rgba(0, 61, 165, 0.35) !important;
    transform: translateY(-1px);
}

/* Botão Warning (Limpar, Painel Atual) */
.btn-warning {
    background: linear-gradient(135deg, #FFD700, #e6c200) !important;
    color: #003DA5 !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.3) !important;
    transition: all 0.2s ease !important;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e6c200, #ccac00) !important;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4) !important;
    transform: translateY(-1px);
}

/* Botão Danger (Apagar, Devolver) */
.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.25) !important;
    transition: all 0.2s ease !important;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #b21f2d) !important;
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.35) !important;
    transform: translateY(-1px);
}

/* Botão Info (Banco Real, Fechamento) */
.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.25) !important;
    transition: all 0.2s ease !important;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b) !important;
    box-shadow: 0 4px 10px rgba(23, 162, 184, 0.35) !important;
    transform: translateY(-1px);
}

/* -----------------------------------------------
   21. STATUS BADGES (A Receber, Recebido, etc.)
   ----------------------------------------------- */
.badge-a-receber,
.status-a-receber {
    background: #FFF3CD !important;
    color: #856404 !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
}

.badge-recebido,
.status-recebido {
    background: #D4EDDA !important;
    color: #155724 !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
}

/* -----------------------------------------------
   22. SCROLLBAR CUSTOMIZADA
   ----------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F4F6FA;
}

::-webkit-scrollbar-thumb {
    background: #bcc4d0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #003DA5;
}

/* -----------------------------------------------
   23. TRANSIÇÃO GLOBAL SUAVE
   ----------------------------------------------- */
a, button, input, select,
.module, .inline-related h3,
#nav-sidebar .module td a {
    transition: all 0.2s ease !important;
}

/* -----------------------------------------------
   24. RESPONSIVE — Mobile Adjustments
   ----------------------------------------------- */
@media (max-width: 767px) {
    #header {
        padding: 10px 16px !important;
    }

    #branding h1 {
        font-size: 18px !important;
    }

    #content {
        padding: 16px !important;
    }

    #content h1 {
        font-size: 22px !important;
    }

    .module > h2,

    .inline-group h2 {

        font-size: 12px !important;

        padding: 10px 14px !important;

    }



    input[type="submit"],

    button[type="submit"],

    .button {

        padding: 8px 16px !important;

        font-size: 13px !important;

    }

}



/* -----------------------------------------------

   25. DARK MODE OVERRIDE (desabilita)

   Força sempre tema claro Mercosul

   ----------------------------------------------- */

@media (prefers-color-scheme: dark) {

    html[data-theme="dark"],

    html:not([data-theme]) {

        --primary: #003DA5;

        --secondary: #003DA5;

        --header-bg: #003DA5;

        --body-bg: #F4F6FA;

        --body-fg: #1a1a2e;

        --sidebar-background: #001F54;

    }

}



/* -----------------------------------------------

   26. PRINT STYLES

   ----------------------------------------------- */

@media print {

    #header,

    #nav-sidebar,

    .breadcrumbs,

    .object-tools,

    .actions {

        display: none !important;

    }



    body {

        background: #FFFFFF !important;

        font-size: 12px !important;

    }



    .module {

        border: 1px solid #ccc !important;

        box-shadow: none !important;

    }

}



/* -----------------------------------------------

   27. NUCLEAR: Remove QUALQUER sublinhado de links

   na tabela de resultados (última regra = prioridade máxima)

   ----------------------------------------------- */

#result_list a,

#result_list a:link,

#result_list a:visited,

#result_list a:hover,

#result_list a:active,

#changelist .results a,

#changelist .results a:link,

#changelist .results a:visited,

#changelist .results a:hover,

#changelist .results a:active,

#changelist table a,

#changelist table a:link,

#changelist table a:visited,

#changelist table a:hover,

#changelist table a:active,

table#result_list a,

#result_list td a,

#result_list th a {

    text-decoration: none !important;

    border-bottom: none !important;

    border-bottom-width: 0 !important;

    box-shadow: none !important;

    outline: none !important;

    background-image: none !important;

}


/* Fix: texto branco APENAS nos h2 de módulo (Ações Recentes, etc) */
.module > h2 a,
.module > h2 a:link,
.module > h2 a:visited {
    color: #FFFFFF !important;
    text-decoration: none !important;
}

/* Fix: links brancos nos headers azuis de módulo (Ações Recentes, Autenticação, Gestão) */
.module > h2 a,
.module > h2 a:link,
.module > h2 a:visited,
.module > table > caption a,
.module > table > caption a:link,
.module > table > caption a:visited,
.inline-group h2 a,
.inline-group h2 a:link {
    color: #FFFFFF !important;
    text-decoration: none !important;
}

/* Fix: links azuis no cabeçalho da TABELA changelist (não amarelo) */
#result_list table thead th a:link,
#result_list table thead th a:visited,
#changelist table thead th a:link,
#changelist table thead th a:visited {
    color: #003DA5 !important;
}

/* === NUCLEAR FIX FINAL: cores de links === */
/* 1. AÇÕES RECENTES e cabeçalhos de módulo = BRANCO sobre azul */
#recent-actions-module h2,
#recent-actions-module h2 a,
div.module h2,
div.module h2 a,
div.module h2 a:link,
div.module h2 a:visited {
    color: #FFFFFF !important;
}

/* 2. Cabeçalho tabela changelist = AZUL */
#result_list th a,
#result_list th a:link,
#result_list th a:visited,
#changelist #result_list th a {
    color: #003DA5 !important;
    font-weight: 700 !important;
}

/* Fix: TODAS as letras dentro de h2 de módulo/inline = BRANCO */
.module > h2 *,
.inline-group h2,
.inline-group h2 *,
.inline-group h2 a,
.inline-group h2 b,
.inline-group h2 span,
fieldset > h2,
fieldset > h2 * {
    color: #FFFFFF !important;
}

/* === FIX DEFINITIVO: títulos de seção nos formulários === */
fieldset.module,
.inline-group .module,
.inline-related {
    overflow: visible !important;
}

fieldset h2,
fieldset.module h2,
.inline-group h2,
.inline-related h2,
.module.aligned h2 {
    color: #FFFFFF !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: unset !important;
}

fieldset h2 *,
fieldset.module h2 *,
.inline-group h2 *,
.inline-related h2 *,
.module.aligned h2 * {
    color: #FFFFFF !important;
}

/* === FIX DEFINITIVO: fieldset-heading = branco === */
h2.fieldset-heading,
fieldset.module h2.fieldset-heading,
fieldset.module.aligned h2.fieldset-heading,
h2[id*="fieldset"][id*="heading"] {
    color: #FFFFFF !important;
}

/* === O FIX QUE FALTAVA: #content tem prioridade alta, precisa dele no seletor === */
#content h2.fieldset-heading,
#content fieldset.module h2,
#content .inline-group h2,
#content .inline-related h2 {
    color: #FFFFFF !important;
}

/* === Fix: campo de ForeignKey (Cliente, etc) === */
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
}

    flex: 1 !important;
    min-width: 200px !important;
    max-width: 400px !important;
}

    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
}

/* === Reverte e corrige: campo ForeignKey sem quebrar layout === */
    display: inline !important;
    flex-wrap: unset !important;
    gap: unset !important;
}

    vertical-align: middle !important;
    flex: unset !important;
}

    vertical-align: middle !important;
    margin: 0 2px !important;
    display: inline !important;
}

/* === LIMPA todas as regras anteriores de related-widget === */
    display: block !important;
    gap: unset !important;
    flex-wrap: unset !important;
    align-items: unset !important;
}

    flex: unset !important;
    vertical-align: middle !important;
    width: auto !important;
    min-width: unset !important;
    max-width: unset !important;
}

    display: unset !important;
    margin: unset !important;
    vertical-align: unset !important;
}

/* === Restaura related-widget ao padrão do Django === */
.related-widget-wrapper {
    float: none !important;
}

.related-widget-wrapper select {
    min-width: 200px !important;
}

.related-widget-wrapper-link {
    color: #003DA5 !important;
}

/* === Fix: esconde texto __str__ duplicado nos inlines tabulares === */
.inline-group .tabular td .original,
.inline-group .tabular .original {
    display: none !important;
}


