* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root,
[data-theme="light"] {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-soft: rgba(37, 99, 235, 0.12);
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #d8e0ea;
    --text: #0f172a;
    --text-light: #64748b;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.12);
    --focus-ring: rgba(37, 99, 235, 0.18);
    --chip-autorizada-bg: #f0fdf4;
    --chip-autorizada-border: #86efac;
    --chip-autorizada-text: #15803d;
    --chip-cancelada-bg: #fef2f2;
    --chip-cancelada-border: #fca5a5;
    --chip-cancelada-text: #b91c1c;
    --chip-inut-bg: #fffbeb;
    --chip-inut-border: #fcd34d;
    --chip-inut-text: #b45309;
    --pdv-bar-bg: #fff7ed;
    --pdv-bar-border: #fdba74;
    --pdv-bar-text: #9a3412;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #60a5fa;
    --primary-soft: rgba(59, 130, 246, 0.2);
    --secondary: #94a3b8;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --bg: #0b1220;
    --surface: #111827;
    --surface-2: #1a2333;
    --border: #2a364a;
    --text: #e5eefb;
    --text-light: #94a3b8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.45);
    --focus-ring: rgba(59, 130, 246, 0.28);
    --chip-autorizada-bg: rgba(22, 163, 74, 0.18);
    --chip-autorizada-border: #166534;
    --chip-autorizada-text: #86efac;
    --chip-cancelada-bg: rgba(220, 38, 38, 0.18);
    --chip-cancelada-border: #991b1b;
    --chip-cancelada-text: #fca5a5;
    --chip-inut-bg: rgba(217, 119, 6, 0.18);
    --chip-inut-border: #92400e;
    --chip-inut-text: #fcd34d;
    --pdv-bar-bg: rgba(234, 88, 12, 0.16);
    --pdv-bar-border: #9a3412;
    --pdv-bar-text: #fdba74;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    color-scheme: dark;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 1680px;
    margin: 0 auto;
    padding: 1rem 1.25rem 1.5rem;
}

header {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 0.85rem;
}

header > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
}

.header-brand h1 {
    margin-bottom: 0.15rem;
}

.header-subtitle {
    margin: 0;
    color: var(--text-light);
    font-size: 0.8125rem;
}

.header-toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.header-toolbar a.btn {
    text-decoration: none;
}

.btn-icon-theme {
    width: 2.35rem;
    height: 2.35rem;
    min-width: 2.35rem;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 0.5rem;
}

.btn-icon-theme:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.btn-icon-theme svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
}

/* Padrão (claro): lua. Escuro: sol. Sempre um visível. */
.btn-icon-theme .theme-icon-sun {
    display: none;
}

.btn-icon-theme .theme-icon-moon {
    display: inline-block;
}

html[data-theme="dark"] .btn-icon-theme .theme-icon-sun {
    display: inline-block;
}

html[data-theme="dark"] .btn-icon-theme .theme-icon-moon {
    display: none;
}

/* Página de configuração — certificado */
.config-cert-section {
    max-width: 960px;
}

.config-cert-help {
    color: var(--text-light);
    margin: -0.75rem 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.45;
}

.config-cert-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.config-cert-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.config-cert-field input[type="file"],
.config-cert-field input[type="password"],
.config-cert-field input[type="text"],
.config-cert-field input[type="email"],
.config-cert-field select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg, #fff);
    color: var(--text);
    font-size: 0.95rem;
}

.config-cert-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.config-users-section {
    max-width: 1100px;
    margin-top: 1.5rem;
}

.config-users-form {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
}

.config-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.75rem;
}

.config-users-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
}

.config-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.config-users-table th,
.config-users-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    color: var(--text);
    vertical-align: middle;
}

.config-users-table th {
    background: var(--surface-2);
    font-weight: 600;
    white-space: nowrap;
}

.config-users-table tr:last-child td {
    border-bottom: none;
}

.config-users-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.config-users-actions .btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
}

.user-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.user-badge--admin {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: var(--primary);
}

.user-badge--user {
    background: var(--surface-2);
    color: var(--text-light);
}

.user-badge--ativo {
    background: var(--chip-autorizada-bg);
    color: var(--chip-autorizada-text);
    border-color: var(--chip-autorizada-border);
}

.user-badge--inativo {
    background: var(--chip-cancelada-bg);
    color: var(--chip-cancelada-text);
    border-color: var(--chip-cancelada-border);
}

.config-cert-status {
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.92rem;
    line-height: 1.45;
    border: 1px solid var(--border);
    background: var(--bg);
}

.config-cert-status--ok {
    background: var(--chip-autorizada-bg);
    border-color: var(--chip-autorizada-border);
    color: var(--chip-autorizada-text);
}

.config-cert-status--aviso {
    background: var(--chip-inut-bg);
    border-color: var(--chip-inut-border);
    color: var(--chip-inut-text);
}

.config-cert-status--erro {
    background: var(--chip-cancelada-bg);
    border-color: var(--chip-cancelada-border);
    color: var(--chip-cancelada-text);
}

.config-cert-status--info {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
}

header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

header p {
    color: var(--text-light);
    font-size: 0.8125rem;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

section {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0;
    letter-spacing: -0.01em;
}

/* Estatísticas */
.stats-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem 0.75rem;
    margin-bottom: 0.75rem;
}

.stats-header-left {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    min-width: 0;
}

.stats-header-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-left: auto;
}

.stats-section .stats-header h2 {
    margin: 0;
}

.stats-periodo {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.stats-periodo-rapido {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.stats-periodo-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stats-periodo-rapido .filters-chips {
    margin: 0;
}

.stats-periodo-rapido .filters-chip {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.stats-header .btn-notas-faltantes {
    margin-left: 0;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border: none;
}

.stats-header .btn-consulta-inut {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.stats-periodo:empty,
.stats-periodo[data-vazio="true"] {
    color: var(--text-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.55rem;
    overflow: visible;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.7rem 0.8rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: clamp(0.95rem, 0.7vw + 0.75rem, 1.35rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    word-break: break-word;
}

/* Filtros */
.filters-section {
    padding: 0.85rem 1.1rem 1rem;
}

.filters-section h2 {
    margin-bottom: 0;
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
    flex-wrap: wrap;
}

.filters-header-text h2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.filters-header-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

.filters-title-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.filters-header-text p {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin: 0;
}

.btn-link-filtros {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.45rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.375rem;
    white-space: nowrap;
    font-family: inherit;
    transition: color 0.2s ease;
}

.btn-link-filtros:hover {
    color: var(--primary);
}

.filters-section--collapsed .filters-body {
    display: none;
}

.filters-section--collapsed .filters-header {
    margin-bottom: 0;
}

.filters-section--collapsed .btn-link-filtros svg {
    transform: rotate(180deg);
}

.filters-fields {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.55rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 0 0 auto;
}

.filter-group--xs {
    width: 4.75rem;
}

.filter-group--sm {
    width: 7.5rem;
}

.filter-group--md {
    width: 8.75rem;
}

.filter-group--date {
    width: 9.75rem;
}

.filter-group--valor {
    width: 7rem;
}

.filter-group--cliente {
    width: 14rem;
    flex: 1 1 12rem;
    max-width: 18rem;
}

.filter-group--grow {
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 18rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}

.filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.filter-input-icon {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
    display: flex;
    align-items: center;
    z-index: 1;
}

.filter-input-icon svg {
    width: 14px;
    height: 14px;
}

.filter-input-wrap input,
.filter-input-wrap select {
    width: 100%;
    padding: 0.45rem 0.55rem 0.45rem 1.9rem;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    font-size: 0.8125rem;
    background: var(--surface-2);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

/* Combos: seta afastada da borda */
.filter-input-wrap select,
.filters-panel-select,
.filters-section select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.1rem;
    background-color: var(--surface-2);
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 12px;
    cursor: pointer;
}

.filter-group--xs .filter-input-wrap input {
    padding-left: 1.85rem;
    padding-right: 0.4rem;
    text-align: center;
    letter-spacing: 0.02em;
}

.filter-group--date .filter-input-wrap input[type="date"] {
    padding-right: 0.35rem;
    min-width: 0;
}

.filter-group input:focus,
.filter-group select:focus,
.filter-input-wrap input:focus,
.filter-input-wrap select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.filter-input-wrap input::placeholder {
    color: var(--text-light);
}

.filter-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: flex-end;
    padding-bottom: 0.05rem;
    margin-left: 0.15rem;
}

.btn-outline {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-soft);
}

.filters-panel-select {
    width: 100%;
    padding: 0.45rem 2.1rem 0.45rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    font-size: 0.8125rem;
    background-color: var(--surface-2);
    color: var(--text);
    font-family: inherit;
}

.filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.filters-chip {
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.filters-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filters-chip.ativo {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.filters-chip-status--autorizada {
    border-color: var(--chip-autorizada-border);
    background: var(--chip-autorizada-bg);
    color: var(--chip-autorizada-text);
}

.filters-chip-status--autorizada.ativo,
.filters-chip-status--autorizada:hover {
    border-color: var(--chip-autorizada-border);
    background: var(--chip-autorizada-bg);
    color: var(--chip-autorizada-text);
    box-shadow: inset 0 0 0 1px var(--chip-autorizada-border);
}

.filters-chip-status--cancelada {
    border-color: var(--chip-cancelada-border);
    background: var(--chip-cancelada-bg);
    color: var(--chip-cancelada-text);
}

.filters-chip-status--cancelada.ativo,
.filters-chip-status--cancelada:hover {
    border-color: var(--chip-cancelada-border);
    background: var(--chip-cancelada-bg);
    color: var(--chip-cancelada-text);
    box-shadow: inset 0 0 0 1px var(--chip-cancelada-border);
}

.filters-chip-status--inutilizada {
    border-color: var(--chip-inut-border);
    background: var(--chip-inut-bg);
    color: var(--chip-inut-text);
}

.filters-chip-status--inutilizada.ativo,
.filters-chip-status--inutilizada:hover {
    border-color: var(--chip-inut-border);
    background: var(--chip-inut-bg);
    color: var(--chip-inut-text);
    box-shadow: inset 0 0 0 1px var(--chip-inut-border);
}

.filters-chip-status--todos {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text-light);
}

.filters-chip-status--todos.ativo {
    border-color: var(--secondary);
    background: var(--primary-soft);
    color: var(--text);
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filters-row {
        gap: 0.5rem;
    }

    .filter-group--cliente,
    .filter-group--grow {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-group--xs,
    .filter-group--sm,
    .filter-group--md,
    .filter-group--date,
    .filter-group--valor,
    .filter-group--cliente {
        width: calc(50% - 0.3rem);
        max-width: none;
        flex: 0 0 calc(50% - 0.3rem);
    }

    .filter-actions {
        width: 100%;
        margin-left: 0;
    }

}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-group--xs,
    .filter-group--sm,
    .filter-group--md,
    .filter-group--date,
    .filter-group--valor,
    .filter-group--cliente {
        width: 100%;
        flex: 0 0 100%;
    }
}

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-light);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-success:hover {
    background: #059669;
}

.btn-orange {
    background: #ea580c;
    color: #fff;
}

.btn-orange:hover {
    background: #c2410c;
    box-shadow: var(--shadow-md);
}

.table-controls-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
}

.barra-pdv-inut {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding: 0.35rem 0.65rem;
    background: var(--pdv-bar-bg);
    border: 1px solid var(--pdv-bar-border);
    border-radius: 0.5rem;
    margin-right: 0.25rem;
}

.barra-pdv-inut-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pdv-bar-text);
    cursor: pointer;
    user-select: none;
}

.barra-pdv-inut-count {
    font-size: 0.8rem;
    color: var(--pdv-bar-text);
    font-weight: 600;
}

.col-check-inut {
    width: 2.25rem;
    text-align: center;
}

.chk-nota-inut {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

tr.nota-inut-selecionada {
    background: #fff7ed;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Tabela */
.table-section {
    overflow: hidden;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.55rem 0.75rem;
}

.table-controls-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.table-controls > span,
.table-controls #totalRegistros {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-weight: 600;
    flex: 0 0 auto;
}

.page-size-control,
.pagination-pagesize {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
}

.page-size-control select,
.pagination-pagesize select {
    min-width: 4.5rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 0.875rem;
}

thead {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

th {
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    user-select: none;
}

th.sortable {
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease;
}

th.sortable:hover {
    background-color: var(--bg);
    color: var(--primary);
}

.sort-indicator {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    transition: opacity 0.2s ease;
    color: var(--primary);
}

td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: var(--surface-2);
}

tbody tr:last-child td {
    border-bottom: none;
}

.loading {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-light);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-sat {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-nfce {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.badge-autorizada {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-cancelada {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-inutilizada {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-sefaz {
    background: rgba(8, 145, 178, 0.12);
    color: #0e7490;
    margin-left: 0.35rem;
    font-size: 0.65rem;
    letter-spacing: 0.02em;
}

.badge-arquivo {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    margin-left: 0.35rem;
    font-size: 0.65rem;
    letter-spacing: 0.02em;
}

/* Cortina lateral (drawer) */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    visibility: hidden;
}

.drawer.aberto {
    pointer-events: auto;
    visibility: visible;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.drawer.aberto .drawer-backdrop {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(560px, 100%);
    background: var(--surface, #fff);
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s ease;
}

.drawer.aberto .drawer-panel {
    transform: translateX(0);
}

.drawer-faltantes {
    width: min(720px, 100%);
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
}

.drawer-header .faltantes-descricao {
    margin-bottom: 0;
}

.drawer-close {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 0.25rem;
}

.drawer-close:hover {
    color: var(--text);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

.drawer-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface, #fff);
}

.drawer-footer.faltantes-acoes {
    margin: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.drawer-footer .btn {
    white-space: nowrap;
}

.btn-view {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-view:hover {
    background: var(--primary);
    color: white;
}

.btn-download {
    background: transparent;
    color: var(--success);
    border: 1px solid var(--success);
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-download:hover {
    background: var(--success);
    color: white;
}

.btn-download svg {
    width: 16px;
    height: 16px;
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination-pages {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.pagination button {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    min-width: 2.4rem;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-ellipsis {
    color: var(--text-light);
    padding: 0 0.25rem;
    user-select: none;
}

.pagination-info {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-left: 0.25rem;
}

.pagination-goto {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.35rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.pagination-goto input[type="number"] {
    width: 4.5rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
}

.pagination-goto .btn-pagination-goto {
    min-width: auto;
    padding: 0.4rem 0.7rem;
}

/* Modal — acima do drawer (z-index 1200) */
.modal {
    display: none;
    position: fixed;
    z-index: 1400;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow: auto;
}

.modal.aberto {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 0;
}

.modal-content {
    background: var(--surface);
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    max-width: 1000px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text);
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    color-scheme: dark;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.close:hover {
    color: var(--text);
    background: var(--bg);
}

#notaDetalhes {
    margin-top: 1rem;
}

.modal-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header-actions .btn svg {
    width: 16px;
    height: 16px;
}

.faltantes-descricao {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.faltantes-resumo {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.faltantes-resumo span {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

.faltantes-grupo {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg);
}

.faltantes-grupo h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.faltantes-numeros {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 200px;
    overflow-y: auto;
}

.faltantes-numero {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 0.25rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.8rem;
    font-family: monospace;
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.2;
}

button.faltantes-numero {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.faltantes-numero:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

button.faltantes-numero:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.faltantes-numero--carrinho {
    background: #166534 !important;
    color: #fff !important;
    border-color: #14532d !important;
    box-shadow: 0 0 0 2px #86efac;
    font-weight: 700;
}

.carrinho-inut-barra {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
    padding: 0.35rem 0.65rem;
    background: #ecfdf5;
    border: 1px solid #86efac;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: #14532d;
    font-weight: 600;
}

.btn-sm {
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
}

.inut-resultado-modal {
    max-width: 640px;
}

.inut-resultado-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0;
}

.inut-resultado-stat {
    flex: 1 1 120px;
    padding: 0.75rem 0.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: #f8fafc;
}

.inut-resultado-stat strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1.2;
}

.inut-resultado-stat span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.inut-resultado-stat--ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.inut-resultado-stat--ja {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.inut-resultado-stat--banco {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #5b21b6;
}

.inut-resultado-stat--falha {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.inut-resultado-lista {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 45vh;
    overflow-y: auto;
}

.inut-resultado-item {
    padding: 0.75rem 0.9rem;
    border-radius: 0.55rem;
    border: 1px solid var(--border);
    background: var(--surface);
}

.inut-resultado-item--ok {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.inut-resultado-item--ja {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.inut-resultado-item--falha {
    border-color: #fecaca;
    background: #fef2f2;
}

.inut-resultado-item-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.inut-resultado-item-topo strong {
    font-size: 0.95rem;
}

.inut-resultado-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}

.inut-resultado-badge--ok {
    background: #166534;
    color: #fff;
}

.inut-resultado-badge--ja {
    background: #1d4ed8;
    color: #fff;
}

.inut-resultado-badge--falha {
    background: #b91c1c;
    color: #fff;
}

.inut-resultado-item p {
    margin: 0;
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.35;
}

.inut-resultado-item small {
    display: block;
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.75rem;
}

.faltantes-numero--chave {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.faltantes-numero--nao-fin {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fdba74;
}

.faltantes-numero--gap {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #c4b5fd;
}

.faltantes-numero--inut-marcada {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #a5b4fc;
    text-decoration: line-through;
}

.faltantes-numero--rej {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.faltantes-legenda {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
    align-items: center;
}

.faltantes-pdv {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
}

.faltantes-pdv span,
.faltantes-pdv strong {
    color: inherit;
}

.faltantes-pdv--aviso {
    background: var(--chip-inut-bg);
    border-color: var(--chip-inut-border);
    color: var(--chip-inut-text);
}

.faltantes-pdv--ok {
    background: var(--chip-autorizada-bg);
    border-color: var(--chip-autorizada-border);
    color: var(--chip-autorizada-text);
}

.faltantes-pdv-erro {
    color: var(--warning);
    width: 100%;
}

.faltantes-resumo span,
.faltantes-resumo strong {
    color: var(--text);
}

.faltantes-acoes {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.faltantes-ok {
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
}

.faltantes-progresso {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
    gap: 0.75rem;
}

.faltantes-progresso-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border);
    border-top-color: var(--primary, #1e40af);
    border-radius: 50%;
    animation: faltantes-spin 0.8s linear infinite;
}

@keyframes faltantes-spin {
    to { transform: rotate(360deg); }
}

.faltantes-progresso-titulo {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.faltantes-progresso-msg {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    min-height: 1.35em;
}

.faltantes-progresso-barra {
    width: min(100%, 320px);
    height: 0.4rem;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.faltantes-progresso-barra-indeterminate {
    width: 40%;
    height: 100%;
    background: var(--primary, #1e40af);
    border-radius: 999px;
    animation: faltantes-barra 1.2s ease-in-out infinite;
}

@keyframes faltantes-barra {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.faltantes-progresso-tempo {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
}

.faltantes-progresso--download {
    padding: 2rem 1.25rem;
}

.faltantes-progresso-contador {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    letter-spacing: -0.02em;
}

.faltantes-progresso-pct {
    margin-left: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary, #1e40af);
}

.faltantes-progresso-chave {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--text-light);
    word-break: break-all;
}

.faltantes-progresso-barra--determinate {
    width: min(100%, 360px);
    height: 0.55rem;
}

.faltantes-progresso-barra-fill {
    height: 100%;
    width: 0;
    background: var(--primary, #1e40af);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.btn-notas-faltantes:disabled,
#btnNotasFaltantes:disabled {
    opacity: 0.65;
    cursor: wait;
}

.modal-impostos {
    max-width: 760px;
    overflow-x: hidden;
}

.impostos-descricao {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.impostos-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 520px) {
    .impostos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.imposto-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.875rem 0.75rem;
    text-align: center;
    min-width: 0;
    overflow: hidden;
}

.imposto-card.destaque {
    border-color: #ea580c;
    background: rgba(234, 88, 12, 0.08);
    grid-column: 1 / -1;
    padding: 1rem 0.75rem;
}

.imposto-card-label-total {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #c2410c;
    margin-bottom: 0.5rem;
}

.imposto-card-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    margin-bottom: 0.4rem;
}

.imposto-card-valor {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.imposto-card.destaque .imposto-card-valor-total {
    color: #ea580c;
    font-size: 1.625rem;
    line-height: 1.15;
}

@media (max-width: 400px) {
    .imposto-card-valor {
        font-size: 0.75rem;
    }

    .imposto-card.destaque .imposto-card-valor-total {
        font-size: 1.35rem;
    }
}

.impostos-resumo-extra {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

@media (min-width: 560px) {
    .impostos-resumo-extra {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.impostos-resumo-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.impostos-resumo-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.impostos-resumo-valor {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.impostos-secao-titulo {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.impostos-tabela-wrap {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.modal-impostos .faltantes-tabela {
    font-size: 0.8125rem;
    min-width: 100%;
}

.modal-impostos .faltantes-tabela th,
.modal-impostos .faltantes-tabela td {
    padding: 0.45rem 0.5rem;
    white-space: nowrap;
}

.faltantes-tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.faltantes-tabela th,
.faltantes-tabela td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.faltantes-tabela th {
    background: var(--surface);
}

.detalhe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detalhe-item {
    padding: 1.25rem;
    background: var(--bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.detalhe-item-full {
    grid-column: 1 / -1;
}

.detalhe-item h3 {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.detalhe-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detalhe-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    align-items: start;
}

.detalhe-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

.detalhe-value {
    font-size: 0.9375rem;
    color: var(--text);
    word-break: break-word;
}

.table-container {
    overflow-x: auto;
    margin-top: 0.75rem;
}

.detalhe-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    font-size: 0.875rem;
}

.detalhe-table thead {
    background: var(--bg);
}

.detalhe-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.detalhe-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.detalhe-table tbody tr:hover {
    background: var(--bg);
}

.detalhe-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsivo */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    header {
        padding: 0;
        margin-bottom: 0.75rem;
    }

    header h1 {
        font-size: 1.2rem;
    }

    section {
        padding: 0.85rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.875rem;
    }

    .stat-label {
        font-size: clamp(0.6rem, 1vw + 0.3rem, 0.72rem);
        margin-bottom: 0.375rem;
    }

    .stat-value {
        font-size: clamp(0.7rem, 2.5vw + 0.2rem, 1.1rem);
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.625rem 0.75rem;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-label {
        font-size: clamp(0.55rem, 1.2vw + 0.25rem, 0.68rem);
        margin-bottom: 0.3rem;
    }

    .stat-value {
        font-size: clamp(0.65rem, 3vw + 0.15rem, 1rem);
        line-height: 1.15;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    header {
        padding: 1rem 0;
    }

    header > div {
        flex-direction: column;
        align-items: flex-start;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    .stat-card {
        padding: 0.875rem;
    }

    .stat-label {
        font-size: clamp(0.6rem, 1.5vw + 0.3rem, 0.72rem);
        margin-bottom: 0.375rem;
    }

    .stat-value {
        font-size: clamp(0.75rem, 3.5vw + 0.2rem, 1.2rem);
        line-height: 1.2;
    }
}

@media (max-width: 360px) {
    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.625rem;
    }

    .stat-label {
        font-size: clamp(0.55rem, 2vw + 0.2rem, 0.65rem);
        margin-bottom: 0.25rem;
    }

    .stat-value {
        font-size: clamp(0.7rem, 4vw + 0.15rem, 1.1rem);
        line-height: 1.15;
    }
}
