/* =========================================================
   NFS-e — STYLE GLOBAL
========================================================= */

/* =========================
   1. RESET E VARIÁVEIS
========================= */
* {
    box-sizing: border-box;
}

:root {
    --nfse-bg-1: #060817;
    --nfse-bg-2: #09122b;
    --nfse-bg-3: #0b1f3d;

    --nfse-blue: #2563eb;
    --nfse-blue-dark: #1d4ed8;
    --nfse-blue-soft: #3f78ac;
    --nfse-cyan: #38bdf8;

    --nfse-sidebar-bg: linear-gradient(
        180deg,
        #0b1830 0%,
        #10264a 45%,
        #143764 100%
    );

    --nfse-sidebar-text: #eaf2ff;
    --nfse-sidebar-muted: #b7c9e8;
    --nfse-sidebar-hover: rgba(96, 165, 250, 0.16);
    --nfse-sidebar-active: rgba(96, 165, 250, 0.24);

    --nfse-text: #1e293b;
    --nfse-muted: #64748b;

    --nfse-card-bg: rgba(255, 255, 255, 0.84);
    --nfse-card-border: rgba(148, 163, 184, 0.18);

    --nfse-radius-xl: 26px;
    --nfse-radius-lg: 20px;
    --nfse-radius-md: 14px;

    --nfse-shadow-card: 0 24px 70px rgba(15, 23, 42, 0.08);
    --nfse-shadow-button: 0 14px 30px rgba(37, 99, 235, 0.18);
}

/* =========================
   2. BASE GLOBAL
========================= */
html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--nfse-text);
    background:
        radial-gradient(circle at 15% 20%, rgba(29, 78, 216, 0.28), transparent 26%),
        radial-gradient(circle at 85% 15%, rgba(56, 189, 248, 0.20), transparent 24%),
        radial-gradient(circle at 70% 85%, rgba(99, 102, 241, 0.20), transparent 25%),
        linear-gradient(135deg, var(--nfse-bg-1), var(--nfse-bg-2) 52%, var(--nfse-bg-3));
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

/*
   Caso alguma tela ainda tenha a topbar antiga,
   ela fica escondida automaticamente.
*/
.topbar {
    display: none !important;
}

/* =========================
   3. LAYOUT GERAL
========================= */
.layout {
    display: flex;
    min-height: 100vh;
    gap: 0;
}

.content {
    flex: 1;
    min-width: 0;
    padding: 22px 26px 24px;
}

/* =========================
   4. SIDEBAR
========================= */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    color: #ffffff;
    background: var(--nfse-sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(2, 8, 23, 0.28);
    margin: 14px 0 14px 14px;
    padding: 14px 12px 18px;
    position: sticky;
    top: 14px;
    height: calc(100vh - 28px);
    overflow-y: auto;
    overflow-x: hidden;
    backdrop-filter: blur(14px);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.sidebar-logo {
    padding: 18px 16px;
    margin-bottom: 14px;
    min-height: 88px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Se usar imagem/logo dentro da sidebar */
.sidebar-logo img {
    max-width: 150px;
    width: 100%;
    height: auto;
    display: block;
}

/* Usuário dentro do menu lateral */
.sidebar-user {
    margin: 0 2px 16px;
    padding: 11px 13px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--nfse-sidebar-text);
    font-size: 12px;
    line-height: 1.35;
}

.sidebar-user span {
    display: block;
    color: var(--nfse-sidebar-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.sidebar-user strong {
    display: block;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

/* Links do menu */
.menu-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 16px;
    color: var(--nfse-sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: all .22s ease;
}

.menu-link i {
    width: 20px;
    min-width: 20px;
    text-align: center;
    color: #d7e8ff;
    font-size: 15px;
}

.menu-link:hover {
    background: var(--nfse-sidebar-hover);
    color: #ffffff;
    text-decoration: none;
    transform: translateX(2px);
}

.menu-link.active {
    background: var(--nfse-sidebar-active);
    color: #ffffff;
}

.logout-link {
    color: #ffd2d2;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.16);
    color: #ffffff;
}

.menu-section-title {
    margin: 18px 14px 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
}

.menu-section-title:first-of-type {
    margin-top: 14px;
}


/* =========================
   5. CABEÇALHO DAS PÁGINAS
========================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.page-subtitle {
    margin: 0;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.5;
}

.bottom-actions,
.edit-actions,
.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* =========================
   6. CARDS PRINCIPAIS
========================= */
.content-card {
    background: var(--nfse-card-bg);
    border: 1px solid var(--nfse-card-border);
    border-radius: var(--nfse-radius-xl);
    box-shadow: var(--nfse-shadow-card);
    backdrop-filter: blur(10px);
    padding: 22px;
}

.card {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    padding: 22px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.painel-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.10);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    margin-bottom: 14px;
}

.card-title {
    margin: 0 0 8px;
    color: #1e293b;
    font-size: 17px;
    font-weight: 800;
}

.card-text {
    margin: 0 0 16px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.card-link {
    display: inline-flex;
    align-items: center;
    color: #2563eb;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
}

.card-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* =========================
   7. BOTÕES
========================= */
.modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    min-height: 42px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.modern-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff !important;
    box-shadow: var(--nfse-shadow-button);
}

.modern-btn-primary:hover {
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.30);
}

.modern-btn-secondary {
    background: rgba(255, 255, 255, 0.92);
    color: #315f93 !important;
    border: 1px solid rgba(148, 163, 184, 0.30);
    box-shadow: none;
    border-radius: 14px;
}

.modern-btn-secondary:hover {
    background: #ffffff;
    color: #244c79 !important;
    transform: translateY(-1px);
}

.icon-btn {
    width: 44px;
    min-width: 44px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 14px;
    font-size: 15px;
}

.modern-btn:disabled,
.modern-btn.is-loading {
    opacity: .85;
    cursor: wait;
    pointer-events: none;
}

/* =========================
   8. FILTROS E FORMULÁRIOS
========================= */
.filters-card {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.78),
        rgba(248, 250, 252, 0.88)
    );
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 16px;
}

.filters-grid {
    width: 100%;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.filter-field label {
    margin: 0;
    color: #3b6ea5;
    font-size: 14px;
    font-weight: 800;
}

.form-control,
.form-control-sm,
.modern-input,
.modern-select,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border-radius: 14px !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    background-color: rgba(255, 255, 255, 0.94) !important;
    color: #1e293b !important;
    font-size: 14px;
    padding: 9px 12px !important;
    outline: none;
    box-shadow: none !important;
}

select,
.modern-select {
    appearance: auto;
}

.form-control:focus,
.form-control-sm:focus,
.modern-input:focus,
.modern-select:focus,
select:focus,
textarea:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15) !important;
    outline: none;
}

.filter-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Grids específicos dos filtros já existentes */
.nfse-xmls-filters-grid {
    display: grid;
    grid-template-columns:
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        minmax(150px, .8fr)
        minmax(320px, 2.4fr)
        48px;
    gap: 14px;
    align-items: end;
}

.nfse-ret-filters-grid {
    display: grid !important;
    grid-template-columns:
        minmax(150px, 1fr)
        minmax(150px, 1fr)
        minmax(320px, 2fr)
        48px;
    gap: 14px;
    align-items: end;
    width: 100%;
}

.nfse-empresas-filters-grid,
.filters-grid.empresas-grid {
    display: grid !important;
    grid-template-columns: minmax(360px, 1fr) minmax(220px, 260px) 56px;
    gap: 14px;
    align-items: end;
    width: 100%;
}

.nfse-baixa-filters-grid {
    display: grid !important;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(160px, .8fr)
        minmax(190px, .9fr)
        130px;
    gap: 14px;
    align-items: end;
    width: 100%;
}

.nfse-baixa-filter-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

.nfse-baixa-filter-actions .modern-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
}

/* Baixa XMLs por empresa */
.nfse-params-grid {
    display: grid !important;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(160px, .75fr)
        minmax(190px, .9fr)
        56px;
    gap: 14px;
    align-items: end;
    width: 100%;
}

.nfse-params-grid .filter-field {
    min-width: 0;
}

.nfse-param-action {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

.nfse-param-action > div {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.nfse-param-action .icon-btn {
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
}

/* =========================
   9. FILTROS ATIVOS
========================= */
.nfse-active-filters {
    margin-top: 14px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(219, 234, 254, .42);
    border: 1px solid rgba(96, 165, 250, .28);
}

.nfse-active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.nfse-active-filters-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1f2937;
    font-weight: 800;
}

.nfse-active-filters-title i {
    color: #2f67a8;
}

.nfse-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nfse-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: #ffffff;
    color: #1f2937;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

.nfse-filter-chip strong {
    color: #2f67a8;
}

.nfse-filter-chip a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #374151;
    text-decoration: none;
    font-size: 11px;
}

.nfse-clear-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #1f2937;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

/* =========================
   10. RESULTADOS / RESUMOS
========================= */
.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 0;
    margin: 4px 0 12px;
    color: #3b6ea5;
    font-size: 14px;
    font-weight: 800;
    font-style: italic;
}

.nfse-summary-grid,
.nfse-ret-summary-grid,
.nfse-cert-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.nfse-summary-card,
.nfse-ret-summary-card,
.nfse-cert-summary-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 18px;
    padding: 16px;
    min-height: 92px;
    color: #1e293b;
    text-decoration: none;
}

.nfse-summary-card span,
.nfse-ret-summary-card span,
.nfse-cert-summary-card span {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 8px;
}

.nfse-summary-card strong,
.nfse-ret-summary-card strong,
.nfse-cert-summary-card strong {
    display: block;
    color: #1e293b;
    font-size: 23px;
    line-height: 1;
}

.nfse-cert-summary-muted {
    background: linear-gradient(135deg, #64748b, #475569) !important;
}

.nfse-cert-summary-muted span,
.nfse-cert-summary-muted strong {
    color: #ffffff !important;
}

.nfse-cert-summary-danger {
    border-color: rgba(220, 38, 38, .28);
    background: #fff5f5;
}

.nfse-cert-summary-alert {
    border-color: rgba(245, 158, 11, .32);
    background: #fffbeb;
}

.nfse-cert-summary-info {
    border-color: rgba(37, 99, 235, .24);
    background: #eff6ff;
}

.nfse-card-filter {
    text-align: left;
    cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.24);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.nfse-card-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.12);
    border-color: rgba(37, 99, 235, 0.34);
}

.nfse-card-filter.active {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

/* =========================
   11. TABELAS
========================= */
.modern-table-wrap {
    width: 100%;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    overflow: hidden;
    position: relative;
}

.table-responsive,
.modern-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.modern-table-responsive {
    max-height: calc(100vh - 330px);
    overflow-y: auto !important;
    overflow-x: auto !important;
    position: relative;
}

.modern-table {
    width: 100%;
    min-width: 100%;
    border-collapse: separate !important;
    border-spacing: 0;
    table-layout: fixed;
    margin-bottom: 0 !important;
    font-size: 14px;
}

.modern-table th,
.modern-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.modern-table thead th,
.modern-table th {
    background: linear-gradient(135deg, #4f87ba, #3f78ac) !important;
    color: #ffffff !important;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border: none !important;
    padding: 13px 10px !important;
    vertical-align: middle;
    font-weight: 800;
}

.modern-table-responsive .modern-table thead th {
    position: sticky !important;
    top: 0;
    z-index: 50;
}

.modern-table thead th a,
.modern-table thead th a:visited,
.modern-table thead th a:hover,
.modern-table thead th a:focus {
    color: #ffffff !important;
    text-decoration: none !important;
}

.modern-table td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
    padding: 10px 10px !important;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.78);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.modern-table tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.88);
}

.modern-table tr:hover td {
    background: rgba(96, 165, 250, 0.10) !important;
}

.modern-table small {
    color: #64748b;
    font-weight: 500;
}

/* Colunas centralizadas usadas no módulo */
.nfse-col-sci,
.nfse-col-status-isis,
.nfse-col-acoes,
.nfse-col-data,
.nfse-col-status,
.nfse-col-tipo,
.nfse-col-nsu,
.nfse-col-numero,
.nfse-col-valor,
.nfse-ret-col-sci,
.nfse-ret-col-cnpj,
.nfse-ret-col-valor,
.nfse-ret-col-acoes,
.nfse-cert-col-id,
.nfse-cert-col-cnpj,
.nfse-cert-col-status,
.nfse-cert-col-validade,
.nfse-cert-col-dias,
.nfse-cert-col-acoes {
    text-align: center;
    white-space: nowrap;
}

.nfse-col-cliente,
.nfse-col-nfse,
.nfse-col-empresa,
.nfse-col-participante,
.nfse-ret-col-empresa,
.nfse-cert-col-empresa,
.nfse-cert-col-titular {
    word-break: break-word;
}

/* Botões de ação em tabela */
.nfse-col-acoes form,
.nfse-cert-col-acoes form,
.nfse-ret-col-acoes form {
    display: inline-flex;
    margin: 0 2px;
    vertical-align: middle;
}

.nfse-col-acoes a,
.nfse-cert-col-acoes a,
.nfse-ret-col-acoes a {
    margin: 0 2px;
    vertical-align: middle;
}

.nfse-acoes-inline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.nfse-acoes-inline .icon-btn,
.nfse-col-acoes .icon-btn,
.nfse-cert-col-acoes .icon-btn,
.nfse-ret-col-acoes .icon-btn {
    width: 36px;
    min-width: 36px;
    height: 34px;
    min-height: 34px;
    border-radius: 12px;
    font-size: 13px;
}

/* =========================
   12. TAGS / BADGES
========================= */
.nfse-tag,
.nfse-cert-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.nfse-tag-ok,
.nfse-tag-regular,
.nfse-cert-ok,
.status-concluido {
    background: rgba(22, 163, 74, .12);
    color: #166534;
}

.nfse-tag-pendente,
.nfse-cert-alerta,
.status-pendente,
.status-processando {
    background: rgba(245, 158, 11, .14);
    color: #92400e;
}

.nfse-tag-cancelada,
.nfse-cert-vencido,
.nfse-cert-erro,
.status-erro {
    background: rgba(220, 38, 38, .12);
    color: #991b1b;
}

.nfse-tag-emitida {
    background: rgba(22, 163, 74, .12);
    color: #166534;
}

.nfse-tag-recebida {
    background: rgba(37, 99, 235, .12);
    color: #1d4ed8;
}

.nfse-tag-outras,
.nfse-cert-sem,
.status-cancelado {
    background: rgba(107, 114, 128, .14);
    color: #4b5563;
}

/* =========================
   13. ALERTAS
========================= */
.nfse-alert-ok,
.nfse-success-box {
    background: #f0fff4;
    border: 1px solid #b7e4c7;
    color: #14532d;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}

.nfse-alert-erro,
.nfse-error-box {
    background: #fff3f3;
    border: 1px solid #f0b5b5;
    color: #8a1f1f;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}

.nfse-alert-erro h3,
.nfse-error-box h3 {
    margin: 0 0 6px;
}

/* =========================
   14. CAIXAS INFORMATIVAS
========================= */
.nfse-empresa-line {
    margin-bottom: 16px;
    color: #315f93;
    font-weight: 800;
}

.nfse-waiting-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 180px;
    margin-top: 16px;
    padding: 28px;
    border: 1px dashed rgba(148, 163, 184, .6);
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.90);
    color: #64748b;
    text-align: center;
}

.nfse-waiting-box i {
    color: #4f7fbd;
    font-size: 28px;
}

.nfse-waiting-box strong {
    color: #1f2937;
    font-size: 15px;
}

.nfse-filter-note {
    margin-top: 10px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

/* =========================
   15. CERTIFICADOS / UPLOAD
========================= */
.nfse-cert-select-row {
    display: flex;
    align-items: end;
    gap: 10px;
    width: 100%;
}

.nfse-select-wrap {
    position: relative;
    width: 100%;
}

.nfse-select-wrap select {
    width: 100%;
    min-height: 46px;
    padding-right: 42px !important;
}

.nfse-cert-upload-form {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, .22);
}

.nfse-cert-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.nfse-file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nfse-file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.nfse-file-button {
    margin: 0;
}

.nfse-file-button.is-disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

.nfse-file-name {
    color: #64748b;
    font-size: 13px;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================
   16. RELATÓRIO DE RETENÇÕES — DETALHES
========================= */
.nfse-ret-table thead th {
    text-align: center;
}

.nfse-ret-table thead th.nfse-ret-col-empresa {
    text-align: left;
}

.nfse-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #ffffff !important;
    text-decoration: none !important;
}

.nfse-sort-active {
    color: #ffffff !important;
    font-size: 10px;
    opacity: .9;
}

.nfse-ret-details-row {
    display: none;
}

.nfse-ret-details-cell {
    background: rgba(238, 243, 248, 0.96) !important;
    padding: 16px !important;
    border-top: 0 !important;
}

.nfse-ret-notas-wrap {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.nfse-ret-notas-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #ffffff;
    margin: 0;
}

.nfse-ret-notas-table th,
.nfse-ret-notas-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
    vertical-align: middle;
}

.nfse-ret-notas-table thead th {
    background: linear-gradient(135deg, #4f87ba, #3f78ac);
    color: #ffffff;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.nfse-ret-notas-table tbody tr:last-child td {
    border-bottom: none;
}

.nfse-ret-notas-table small {
    color: #64748b;
    font-size: 11px;
}

.nfse-ret-nota-valor {
    text-align: center;
    white-space: nowrap;
}


/* Detalhamento das notas - azul claro */
.nfse-ret-details-row > td {
    background: #eaf3ff !important;
    padding: 8px 12px 14px 42px !important;
    border-bottom: 10px solid #f1f5f9 !important;
}

.nfse-ret-details-cell {
    padding-top: 0 !important;
}

.nfse-ret-notas-wrap {
    border-left: 4px solid #60a5fa;
    padding-left: 12px;
}

.nfse-ret-notas-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    overflow: hidden;
    font-size: 12px;
}

.nfse-ret-notas-table thead th {
    background: #dbeafe !important;
    color: #1e3a8a !important;
    font-size: 11px;
    font-weight: 700;
    border-bottom: 1px solid #bfdbfe !important;
}

.nfse-ret-notas-table tbody td {
    background: #ffffff !important;
    border-bottom: 1px solid #e5edf8;
}

.nfse-ret-notas-table tbody tr:last-child td {
    border-bottom: 0;
}

.nfse-ret-main-row-open > td {
    background: #f0f7ff !important;
}

/* =========================
   17. FILA DE BAIXA
========================= */
.muted {
    color: #64748b;
}

.progress-wrap {
    width: 100%;
    background: rgba(226, 232, 240, .9);
    border-radius: 999px;
    overflow: hidden;
    height: 12px;
}

.progress-bar {
    height: 12px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 999px;
}

/* =========================
   18. RESPONSIVO
========================= */
@media (max-width: 1200px) {
    .nfse-xmls-filters-grid,
    .nfse-ret-filters-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .nfse-xmls-filter-busca,
    .nfse-xmls-filter-actions {
        grid-column: 1 / -1;
    }

    .nfse-cert-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: auto;
        height: auto;
        min-height: auto;
        position: relative;
        top: auto;
        margin: 12px;
        overflow-y: visible;
    }

    .content {
        padding: 14px;
    }

    .page-header {
        flex-direction: column;
    }

    .nfse-xmls-filters-grid,
    .nfse-ret-filters-grid,
    .nfse-empresas-filters-grid,
    .nfse-baixa-filters-grid,
    .nfse-params-grid,
    .filters-grid.empresas-grid,
    .nfse-cert-grid {
        grid-template-columns: 1fr !important;
    }
    
    .filter-actions-row {
        justify-content: flex-start;
    }
    
    .nfse-param-action {
        justify-content: flex-start;
    }
    
    .nfse-param-action > div {
        justify-content: flex-start;
    }

    .nfse-cert-select-row {
        flex-direction: column;
        align-items: stretch;
    }

    .results-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .content-card {
        padding: 16px;
        border-radius: 20px;
    }

    .page-title {
        font-size: 23px;
    }

    .cards,
    .painel-cards,
    .nfse-summary-grid,
    .nfse-ret-summary-grid,
    .nfse-cert-summary-grid {
        grid-template-columns: 1fr;
    }

    .modern-table {
        font-size: 12px;
    }
}

/* =========================
   19. LOGIN NFS-e
========================= */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    color: #ffffff;
    background:
        radial-gradient(circle at 15% 20%, rgba(29, 78, 216, 0.34), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(56, 189, 248, 0.24), transparent 26%),
        radial-gradient(circle at 70% 85%, rgba(99, 102, 241, 0.22), transparent 28%),
        linear-gradient(135deg, #060817, #09122b 52%, #0b1f3d);
}

/* Container externo: só centraliza e define largura */
.login-page .login-container {
    width: 100%;
    max-width: 430px;
}

/* Card real do login */
.login-page .login-card {
    width: 100%;
    padding: 36px 32px;
    border-radius: 28px;
    background: linear-gradient(
        180deg,
        rgba(13, 27, 62, 0.94),
        rgba(9, 18, 43, 0.86)
    );
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 25px 80px rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(18px);
    color: #ffffff;
}

.login-page .login-title {
    color: #ffffff;
    text-align: center;
    margin: 0 0 18px;
    font-size: 32px;
    font-weight: 800;
}

.login-page .login-subtitle {
    color: #cbd5e1;
    text-align: center;
    margin: 0 0 26px;
    font-size: 15px;
    line-height: 1.45;
}

.login-page form {
    display: grid;
    gap: 16px;
}

.login-page .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.login-page label {
    color: #e2e8f0;
    font-weight: 700;
    font-size: 14px;
}

.login-page input[type="text"],
.login-page input[type="email"],
.login-page input[type="password"] {
    width: 100%;
    min-height: 48px;
    border-radius: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    color: #111827 !important;
    padding: 10px 14px !important;
    outline: none;
}

.login-page input::placeholder {
    color: #94a3b8;
}

.login-page input:focus {
    border-color: rgba(56, 189, 248, 0.75) !important;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14) !important;
}

.login-page .btn-login {
    width: 100%;
    min-height: 50px;
    margin-top: 2px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #4f46e5, #38bdf8);
    color: #ffffff !important;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 18px 45px rgba(37, 99, 235, 0.38);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.login-page .btn-login:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 24px 54px rgba(37, 99, 235, 0.45);
}

.login-page .alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
    text-align: center;
    font-size: 14px;
}

.login-page .footer-text {
    margin-top: 16px;
    color: #cbd5e1;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .painel-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body.login-page {
        padding: 18px;
    }

    .login-page .login-card {
        padding: 30px 22px;
        border-radius: 22px;
    }
}