/* ============================================================
   SIGDEC — Design System Moderno
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   Variáveis CSS
   ============================================================ */
:root {
    --primary:           #F5703C;
    --primary-hover:     #d95e2c;
    --primary-alpha:     rgba(245, 112, 60, 0.12);
    --secondary:         #000F5C;
    --secondary-hover:   #001580;

    --sidebar-bg:        #0a1929;
    --sidebar-text:      #b0bec5;
    --sidebar-hover-bg:  rgba(245, 112, 60, 0.1);
    --sidebar-border:    rgba(255, 255, 255, 0.06);
    --sidebar-width:     252px;

    --header-height:     60px;
    --body-bg:           #eef1f6;
    --card-bg:           #ffffff;
    --card-shadow:       0 1px 6px rgba(0,0,0,0.07), 0 4px 18px rgba(0,0,0,0.05);
    --radius:            10px;
    --radius-sm:         6px;

    --text-primary:      #1a202c;
    --text-secondary:    #718096;

    --success:           #38a169;
    --danger:            #e53e3e;
    --warning:           #d69e2e;
    --info:              #3182ce;

    --transition:        all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0 !important;
    padding: 0;
    height: 100%;
    background: var(--body-bg);
    font-family: 'Inter', system-ui, Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.55;
    overflow-x: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */
#app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.18);
}

/* — Brand / Logo — */
#sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px;
    text-decoration: none !important;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.03);
    min-height: 78px;
    transition: var(--transition);
    flex-shrink: 0;
}
#sidebar-brand:hover { background: rgba(255, 255, 255, 0.06); }

#sidebar-brand .brand-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
}

#sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }

#sidebar-brand-text .brand-title {
    font-size: 10.5px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#sidebar-brand-text .brand-subtitle {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 4px;
}

/* — User Welcome — */
#sidebar-user {
    padding: 9px 14px 9px 42px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--sidebar-border);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    min-height: 42px;
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}
#sidebar-user::before {
    content: '\F4DB';
    font-family: 'bootstrap-icons';
    font-size: 17px;
    color: var(--primary);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
}
#sidebar-user .col-md-12 { padding: 0; width: auto; flex: 1; }

/* — Nav — */
#sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
#sidebar-nav::-webkit-scrollbar { width: 4px; }
#sidebar-nav::-webkit-scrollbar-track { background: transparent; }
#sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* — Menu Items (usa classes .row.menu e .barra existentes) — */
div.row.menu {
    margin: 0 !important;
    border: none !important;
    width: 100%;
    display: block !important;
}

div.row.menu a.barra,
div.row.menu a.barra:link,
div.row.menu a.barra:visited,
div.row.menu a.barra2,
div.row.menu a.barra2:link,
div.row.menu a.barra2:visited {
    display: flex !important;
    align-items: center;
    gap: 9px;
    padding: 9px 14px 9px 18px !important;
    color: var(--sidebar-text) !important;
    background: transparent !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    border-bottom: none !important;
    line-height: 1.35;
    width: 100%;
    height: auto;
}

div.row.menu a.barra:hover,
div.row.menu a.barra:active,
div.row.menu a.barra2:hover,
div.row.menu a.barra2:active {
    color: #ffffff !important;
    background: var(--sidebar-hover-bg) !important;
    border-left-color: var(--primary) !important;
    padding-left: 22px !important;
    text-decoration: none !important;
}

/* Ícones nos links de menu */
div.row.menu a.barra i,
div.row.menu a.barra2 i {
    font-size: 15px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    opacity: 0.85;
    transition: var(--transition);
}

div.row.menu a.barra:hover i,
div.row.menu a.barra2:hover i { opacity: 1; }

/* Link Sair */
div.row.menu a#sair,
div.row.menu a[id="sair"] {
    color: #fc8181 !important;
    margin-top: 4px;
    border-top: 1px solid var(--sidebar-border);
}
div.row.menu a#sair:hover { background: rgba(252,129,129,0.1) !important; border-left-color: #fc8181 !important; }

/* Link Retornar */
div.row.menu a#sigdec,
div.row.menu a[id="sigdec"] {
    color: #90cdf4 !important;
    border-top: 1px solid var(--sidebar-border);
}
div.row.menu a#sigdec:hover { background: rgba(144,205,244,0.1) !important; border-left-color: #90cdf4 !important; }

/* ============================================================
   Main Wrapper
   ============================================================ */
#app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Header (Top Bar)
   ============================================================ */
#app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--secondary);
    display: flex;
    align-items: center;
    padding: 0 22px;
    z-index: 1029;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    gap: 14px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

#sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
#sidebar-toggle:hover { background: rgba(255, 255, 255, 0.2); }

#header-module {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
#header-module .module-name {
    font-size: 10px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    line-height: 1;
}
#header-module .page-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    margin-top: 3px;
}

#header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
#header-right img.header-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    opacity: 0.9;
    filter: brightness(1.1);
}

/* ============================================================
   App Content
   ============================================================ */
#app-content {
    flex: 1;
    padding: 26px 22px 52px;
    overflow-x: hidden;
}

/* ============================================================
   Footer — fixed at bottom, always visible
   ============================================================ */
#app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1020;
    height: 36px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}
/* When sidebar is visible, push footer past it */
body.logado #app-footer {
    left: var(--sidebar-width);
    transition: left 0.28s ease;
}
body.logado.sidebar-collapsed #app-footer {
    left: 0;
}
#app-footer img { height: 22px; opacity: 0.65; }

/* ============================================================
   Sidebar Overlay (mobile)
   ============================================================ */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1029;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    border: none !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--card-shadow) !important;
    background: var(--card-bg) !important;
}
.card-header {
    background: linear-gradient(120deg, var(--secondary), #1a34a0) !important;
    color: white !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    border: none !important;
    padding: 13px 20px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 0.3px !important;
}

/* ============================================================
   Formulário (container de formulários)
   ============================================================ */
div#formulario {
    background: var(--card-bg) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--card-shadow) !important;
    padding: 24px 26px !important;
    text-align: left !important;
}

div#formulario .form-group > h3,
div#formulario > .form-group:first-child h3,
div#formulario > h3,
div#formulario h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--secondary) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 20px !important;
    padding-bottom: 11px !important;
    border-bottom: 3px solid var(--primary) !important;
    display: block !important;
    text-align: left !important;
}

div#titulo {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--secondary) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding-bottom: 11px !important;
    border-bottom: 3px solid var(--primary) !important;
    margin-bottom: 20px !important;
}

/* ============================================================
   Form Controls
   ============================================================ */
.form-control {
    border: 1px solid #cbd5e0 !important;
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    padding: 7px 11px !important;
    color: var(--text-primary) !important;
    transition: var(--transition) !important;
    background: #fafbfc !important;
    height: auto !important;
}
.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(245, 112, 60, 0.15) !important;
    background: #ffffff !important;
    outline: none !important;
}
.form-control:disabled {
    background: #f1f3f5 !important;
    color: #a0aec0 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed;
}

.form-group label,
.form-group strong,
div#formulario strong {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: block;
    margin-bottom: 5px;
}

/* ============================================================
   Botões
   ============================================================ */
.btn {
    font-weight: 600 !important;
    font-size: 13px !important;
    border-radius: var(--radius-sm) !important;
    transition: var(--transition) !important;
    letter-spacing: 0.3px !important;
    padding: 8px 18px !important;
}
.btn-primary {
    background: var(--secondary) !important;
    border-color: var(--secondary) !important;
    color: #fff !important;
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--secondary-hover) !important;
    border-color: var(--secondary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,15,92,0.3) !important;
}
.btn-success { background: var(--success) !important; border-color: var(--success) !important; color:#fff !important; }
.btn-danger  { background: var(--danger)  !important; border-color: var(--danger)  !important; color:#fff !important; }
.btn-warning { background: var(--warning) !important; border-color: var(--warning) !important; color:#fff !important; }
.btn-block   { display: block !important; width: 100% !important; }

/* ============================================================
   Tabelas (Legacy + Bootstrap)
   ============================================================ */
#app-content table,
#conteudo table {
    width: 100%;
    border-collapse: collapse !important;
    font-size: 12px !important;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow) !important;
    margin-bottom: 16px !important;
    border: none !important;
}

/* Tabelas em views híbridas (col ao lado do formulário) — fonte menor */
.col-md-6 table.table,
.col-md-5 table.table,
.col-md-4 table.table {
    font-size: 11px !important;
}
.col-md-6 table.table td,
.col-md-6 table.table th,
.col-md-5 table.table td,
.col-md-5 table.table th,
.col-md-4 table.table td,
.col-md-4 table.table th {
    padding: 7px 9px !important;
    font-size: 11px !important;
}
/* Badges dentro de tabelas híbridas — acompanham a fonte */
.col-md-6 table.table .badge,
.col-md-5 table.table .badge,
.col-md-4 table.table .badge {
    font-size: 10px !important;
}

/* Linha de cabeçalho: thead ou tr com bgcolor (legado) */
#app-content table thead tr,
#app-content table tr[bgcolor],
#conteudo table thead tr,
#conteudo table tr[bgcolor] {
    background: var(--secondary) !important;
}
#app-content table thead tr td,
#app-content table thead tr th,
#app-content table tr[bgcolor] td,
#app-content table tr[bgcolor] th,
#conteudo table thead tr td,
#conteudo table thead tr th,
#conteudo table tr[bgcolor] td,
#conteudo table tr[bgcolor] th {
    background: transparent !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 11px 12px !important;
    border: none !important;
    border-bottom: 2px solid rgba(255,255,255,0.12) !important;
    white-space: nowrap;
}

/* Linhas do corpo */
#app-content table tbody tr,
#app-content table tr:not([bgcolor]),
#conteudo table tbody tr,
#conteudo table tr:not([bgcolor]) {
    border-bottom: 1px solid #edf2f7 !important;
    transition: background 0.15s ease;
}
#app-content table tbody tr:hover,
#conteudo table tbody tr:hover {
    background: #fff5f0 !important;
}

/* Linhas alternadas legado (bgcolor="#CCCCCCD") */
#app-content table tr[bgcolor="#CCCCCCD"],
#conteudo table tr[bgcolor="#CCCCCCD"] {
    background: #f7f8fa !important;
}
#app-content table tr[bgcolor="#CCCCCCD"]:hover,
#conteudo table tr[bgcolor="#CCCCCCD"]:hover {
    background: #fff5f0 !important;
}

#app-content table td,
#app-content table th,
#conteudo table td,
#conteudo table th {
    padding: 9px 12px !important;
    border: none !important;
    border-bottom: 1px solid #edf2f7 !important;
    vertical-align: middle !important;
}

/* Ícones em tabelas */
#app-content table img,
#conteudo table img {
    border-radius: 4px;
    transition: var(--transition);
    object-fit: contain;
}
#app-content table a:hover img,
#conteudo table a:hover img {
    transform: scale(1.15);
    filter: brightness(1.1);
}

/* Bootstrap table classes */
.table { margin-bottom: 0 !important; }
.table-hover tbody tr:hover { background-color: #fff5f0 !important; }
.table-bordered { border: none !important; }
.table-striped tbody tr:nth-of-type(odd) { background-color: #f7f8fa !important; }

/* ============================================================
   Alertas
   ============================================================ */
.alert {
    border: none !important;
    border-radius: var(--radius-sm) !important;
    border-left: 4px solid transparent !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 11px 16px !important;
}
.alert-success { background: #f0fff4 !important; border-left-color: var(--success) !important; color: #276749 !important; }
.alert-danger  { background: #fff5f5 !important; border-left-color: var(--danger)  !important; color: #9b2c2c !important; }
.alert-warning { background: #fffbeb !important; border-left-color: var(--warning) !important; color: #7b5e0c !important; }
.alert-info    { background: #ebf8ff !important; border-left-color: var(--info)    !important; color: #2c5282 !important; }
.close { opacity: 0.5 !important; font-size: 18px !important; }

/* ============================================================
   Login Page
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    background: var(--body-bg);
}

.login-left {
    flex: 1;
    background: linear-gradient(150deg, #0a1929 0%, var(--secondary) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    gap: 22px;
    position: relative;
    overflow: hidden;
}
.login-left::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,112,60,0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}
.login-left::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,112,60,0.1) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
}

.login-left .login-logo {
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
    position: relative;
    z-index: 1;
}
.login-left .login-title {
    color: #ffffff;
    font-size: 32px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
}
.login-left .login-subtitle {
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    font-size: 13.5px;
    line-height: 1.65;
    max-width: 360px;
    position: relative;
    z-index: 1;
}
.login-left .login-version {
    position: absolute;
    bottom: 20px;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    z-index: 1;
}

.login-right {
    width: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 44px 84px;
    background: #ffffff;
    box-shadow: -4px 0 28px rgba(0,0,0,0.08);
}
.login-form-wrapper { width: 100%; max-width: 360px; }
.login-form-wrapper .login-header-icon {
    width: 52px;
    height: 52px;
    background: var(--primary-alpha);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: var(--primary);
}
.login-form-wrapper h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 6px;
}
.login-form-wrapper .login-caption {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
.login-form-wrapper .form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
}
.login-form-wrapper .form-control {
    height: 44px !important;
    font-size: 14px !important;
    padding: 10px 14px !important;
}
.login-form-wrapper .btn-primary {
    height: 44px;
    font-size: 14px !important;
    letter-spacing: 0.4px !important;
}
.login-footer-text {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================================
   Tipografia geral
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', system-ui, Arial, sans-serif;
    color: var(--text-primary);
}
h4 { font-size: 18px; font-weight: 700; text-align: center; }

/* ============================================================
   Scrollbar global
   ============================================================ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c0cad8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* ============================================================
   Utilitários
   ============================================================ */
div.row {
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
#app-content div.row { margin-left: unset !important; margin-right: unset !important; }
#app-content .container { max-width: 100%; }

input[type="radio"], input[type="checkbox"] { accent-color: var(--primary); }

/* Badge moderno */
.badge { font-size: 11px !important; border-radius: 4px !important; font-weight: 600 !important; padding: 3px 7px !important; }
.badge-primary   { background: var(--secondary) !important; }
.badge-success   { background: var(--success)   !important; }
.badge-danger    { background: var(--danger)     !important; }
.badge-warning   { background: var(--warning)    !important; color: #1a202c !important; }

/* ============================================================
   Padrão híbrido: formulário + tabela lado a lado
   ============================================================ */
/* Container de tabela com overflow (padrão das views) */
#app-content div[style*="overflow:auto"],
#app-content div[style*="overflow: auto"] {
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: var(--card-bg);
    overflow: auto;
    padding: 0 !important;
}

/* Remove padding do container Bootstrap dentro do conteúdo */
#app-content .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Seção de subtítulo dentro de tabelas (ex: "OBSERVAÇÕES SOBRE O EVENTO") */
#app-content td[colspan][style*="background-color"],
#app-content div[style*="background-color:#D3D3D3"],
#app-content div[style*="background-color: #D3D3D3"] {
    background: var(--secondary) !important;
    color: #ffffff !important;
    border-radius: 6px;
    padding: 8px 12px !important;
    font-size: 12px !important;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

/* Título de seção inline (h3 fora do formulário) */
#app-content > .row > .col-md-12 > h3,
#app-content > .row > div > h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary);
    margin-bottom: 18px;
}

/* Badges de status (padrão legado: style="color: red") */
#app-content table td[style*="color: red"],
#conteudo table td[style*="color: red"] {
    color: var(--danger) !important;
    font-weight: 600;
}

/* Links de ação nas tabelas (abre relatório em popup) */
#app-content table a,
#conteudo table a {
    color: var(--secondary);
    transition: var(--transition);
}
#app-content table a:hover,
#conteudo table a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* Padding generoso nas primeiras rows de conteúdo */
#app-content > .row:first-child {
    gap: 0;
}

/* Separador visual entre formulário e tabela na mesma linha */
#app-content .row > div#formulario + div {
    padding-left: 16px;
}

/* Tabela dentro de container com overflow → sem border-radius próprio */
#app-content div[style*="overflow:auto"] table,
#app-content div[style*="overflow: auto"] table {
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
}

/* Garante que table.table use estilos modernos também */
#app-content .table thead th,
#app-content .table thead td {
    background: var(--secondary) !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border: none !important;
    border-bottom: 2px solid rgba(255,255,255,0.12) !important;
    padding: 11px 12px !important;
    white-space: nowrap;
}
#app-content .table tbody tr {
    border-bottom: 1px solid #edf2f7 !important;
}
#app-content .table td, #app-content .table th {
    padding: 9px 12px !important;
    border: none !important;
    border-bottom: 1px solid #edf2f7 !important;
    vertical-align: middle !important;
    font-size: 13px !important;
}

/* ============================================================
   Menu Retrátil — Desktop
   ============================================================ */
body.sidebar-collapsed #app-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
body.sidebar-collapsed #app-main {
    margin-left: 0;
}

/* ============================================================
   Correção global: scroll horizontal em cards com overflow:hidden
   Tabelas modernas usam overflow:hidden para clip do border-radius,
   mas isso bloqueia o scroll-x. Este !important libera sem quebrar
   o visual arredondado (border-radius continua aplicado com overflow:auto).
   ============================================================ */
#app-content div[style*="overflow:hidden"],
#app-content div[style*="overflow: hidden"] {
    overflow-x: auto !important;
}

/* ============================================================
   Responsivo — Tablet (769px-991px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 991px) {
    :root { --sidebar-width: 220px; }

    #app-content {
        padding: 16px 12px;
    }

    div#formulario {
        padding: 18px !important;
    }

    /* Empilha layout híbrido (formulário + tabela lado a lado) em tablet */
    #app-content > .row > .col-md-6,
    #app-content > .row > .col-md-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Remove padding lateral extra ao empilhar */
    #app-content .row > div#formulario + div {
        padding-left: 15px !important;
        margin-top: 16px;
    }
}

/* ============================================================
   Responsivo — Notebook pequeno (992px–1200px)
   ============================================================ */
@media (min-width: 992px) and (max-width: 1200px) {
    /* Reduz padding quando sidebar ocupa espaço */
    #app-content {
        padding: 20px 16px;
    }

    /* Diminui levemente a fonte das tabelas híbridas */
    .col-md-6 table.table td,
    .col-md-6 table.table th {
        padding: 6px 7px !important;
        font-size: 10px !important;
    }
    .col-md-6 table.table .badge {
        font-size: 9px !important;
    }
}

/* ============================================================
   Responsivo — Mobile (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    #app-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        z-index: 1031;
    }
    #app-sidebar.sidebar-open {
        transform: translateX(0);
    }
    #app-main {
        margin-left: 0 !important;
    }
    #sidebar-overlay.show {
        display: block;
    }
    #app-content {
        padding: 12px 10px 52px;
    }
    body.logado #app-footer {
        left: 0;
    }
    #app-header {
        padding: 0 12px;
        gap: 8px;
    }
    div#formulario {
        padding: 14px !important;
    }
    .login-left {
        display: none;
    }
    .login-right {
        width: 100%;
        padding: 28px 22px 64px;
    }
    #header-module .page-title {
        font-size: 13px;
    }
    #header-module .module-name {
        display: none;
    }

    /* Todas as colunas ficam 100% em mobile */
    #app-content .col-md-6,
    #app-content .col-md-5,
    #app-content .col-md-4,
    #app-content .col-md-8,
    #app-content .col-md-3,
    #app-content .col-md-2 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 10px;
    }
    /* Exceto col-auto e colunas dentro de form-group row (campos lado a lado no form) */
    #app-content .form-group > .row > [class*="col-md-"] {
        flex: unset !important;
        max-width: unset !important;
        margin-bottom: 0;
    }

    /* Botões de formulário empilhados */
    .form-group .col-md-auto {
        width: auto;
        margin-right: 8px;
        display: inline-block;
        margin-bottom: 8px;
    }

    /* Card de tabela: altura menor em mobile para não tomar tela toda */
    #app-content div[style*="max-height"] {
        max-height: 50vh !important;
    }

    /* H3 de formulário menor */
    div#formulario h3 {
        font-size: 13px !important;
    }
}
