* {
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #0f172a;
    --border: #e2e8f0;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 24px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    gap: 16px;
    transition: 0.2s ease;
}

.nav-links li:hover a {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-links li.active a {
    background-color: var(--sidebar-active);
    color: #fff;
    border-left: 4px solid var(--primary);
}

/* Header Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-content.hub-active {
    background: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
        var(--bg-main);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 48px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.page-title {
    margin: 0 0 8px 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Content Area */
.content-wrapper {
    padding: 48px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
}

.sendpilot-active .content-wrapper, .admin-active .content-wrapper {
    justify-content: flex-start;
    max-width: none;
}

.upload-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 800px;
    padding: 48px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 64px 32px;
    cursor: pointer;
    transition: 0.3s ease;
    background-color: #f8fafc;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background-color: #eff6ff;
}

.cloud-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 24px;
}

.drop-zone h3 {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
}

.helper-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Hidden views */
.hidden {
    display: none !important;
}

/* Spinner & Processing */
.processing-view {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

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

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-top: 24px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.4s ease;
}

.btn-tour-public:hover {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.btn-tour-public i {
    transition: transform 0.3s ease;
}

.btn-tour-public:hover i {
    transform: scale(1.05);
}

/* Success View */
.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 24px;
}

.success-view h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.success-warning {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    padding: 16px 20px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 90%;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1rem;
    text-align: left;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.15);
}

.success-warning i {
    color: #dc2626;
    font-size: 1.8rem;
}

.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    border: none;
}

.btn:disabled {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.7;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

/* ── Modal de Confirmação Global ──────────────────────────────────────── */
.global-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.global-confirm-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 769px) {
    .global-confirm-overlay {
        background: rgba(15, 23, 42, 0.7);
    }
    .global-confirm-overlay.visible {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

.global-confirm-overlay.visible .global-confirm-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.global-confirm-card {
    background: white;
    border-radius: 24px;
    padding: 36px 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    text-align: center;
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 480px) {
    .global-confirm-card {
        padding: 24px 20px;
        border-radius: 16px;
    }
}

.global-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 20px;
}

.global-confirm-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 10px;
}

.global-confirm-msg {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 28px;
    line-height: 1.6;
}

.global-confirm-actions {
    display: flex;
    gap: 12px;
}

.global-confirm-btn {
    flex: 1;
    height: 48px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.global-confirm-btn.cancel {
    background: #f1f5f9;
    color: #64748b;
}

.global-confirm-btn.cancel:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.global-confirm-btn.confirm {
    color: white;
}

.global-confirm-btn.confirm:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

/* Toasts Notification */
.toast-container {
    position: fixed;
    bottom: 90px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    background: #fff;
    border-left: 4px solid var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 16px 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideUp 0.4s ease forwards;
}

.toast.error {
    border-color: var(--error);
}

.toast.error i {
    color: var(--error);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* History View */
.history-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 1200px;
    padding: 24px 32px;
    transition: all 0.3s ease;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.history-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-main);
}

.history-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.history-header-actions .btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.table-container,
.history-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th, .history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.history-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
}

.history-table tr:hover td {
    background: #f8fafc;
}

.history-table td {
    font-size: 0.95rem;
    color: var(--text-main);
    vertical-align: middle;
    white-space: nowrap;
}

.history-table td.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

/* Modal de Duplicata */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px 48px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.modal-icon {
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 16px;
}

.modal-box h3 {
    margin: 0 0 12px 0;
    font-size: 1.4rem;
}

.modal-box p {
    margin: 0 0 8px 0;
    color: var(--text-main);
}

.modal-sub {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    margin-bottom: 28px !important;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.file-name-cell {
    white-space: nowrap;
}

/* Estado da linha quando o arquivo já foi baixado — Minimalista & Elegante */
tr.is-downloaded td {
    background-color: rgba(248, 250, 252, 0.4);
}

tr.is-downloaded .file-name-cell {
    color: var(--text-muted);
}

tr.is-downloaded .file-name-cell i {
    color: var(--success) !important;
}

/* Adiciona um check discreto após o nome em vez de um badge grande */
tr.is-downloaded .file-name-cell::after {
    content: '\f058'; /* fa-circle-check */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--success);
    font-size: 0.85rem;
    margin-left: 4px;
}

.history-table th:first-child,
.history-table td:first-child {
    text-align: center;
    width: 48px;
    padding-left: 12px;
    padding-right: 12px;
}

/* Campo opcional de override do NumeroLote */
.lote-override-wrapper {
    margin-top: 20px;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 10px;
    text-align: left;
    transition: border-color 0.2s ease;
}

.lote-override-wrapper:focus-within {
    border-color: var(--primary);
    background: #eff6ff;
}

.lote-override-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    cursor: default;
}

.lote-override-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.lote-override-input {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
    appearance: textfield;
}

.lote-override-input::-webkit-outer-spin-button,
.lote-override-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.lote-override-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.lote-override-input::placeholder {
    color: #b0bec5;
}

/* 🏢 Banner de Ajuda Premium Interativo 🏢 */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    background: rgba(248, 250, 252, 0.8); /* Fundo semi-transparente */
    backdrop-filter: blur(4px); /* Suave efeito de vidro */
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #CBD5E1; /* Borda lateral neutra padrão */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Animação elástica premium */
    cursor: default;
}

/* 🚀 Efeito Hover: Segue o padrão dos inputs mas com "vida" */
.info-banner:hover {
    border-color: var(--primary); /* Borda azul igual ao input */
    border-left-color: var(--primary);
    background: #fff;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.08); /* Glow azul suave */
}

/* Ícone com destaque dinâmico (apenas o ícone principal do banner) */
.info-banner > i {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    width: 38px;
    height: 38px;
    border-radius: 10px; /* Quadrado arredondado moderno */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.info-banner:hover > i {
    background: var(--primary);
    color: #fff;
}

.info-content {
    flex: 1;
}

.info-content strong {
    display: block;
    color: #1e293b;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.info-content p {
    transition: color 0.3s ease;
    margin-bottom: 12px !important;
}

/* 🔍 Barra de Busca Manual no Banner 🔍 */
.rps-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    max-width: 320px;
}

.rps-search-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    outline: none;
    transition: all 0.2s ease;
}

.rps-search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.rps-search-bar button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.rps-search-bar button:hover {
    background: #1d4ed8;
}

.info-banner:hover .info-content p {
    color: #334155;
}

.info-content p span {
    color: var(--primary);
    font-weight: 700;
    background: rgba(37, 99, 235, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

@keyframes slideInInfo {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.info-banner {
    animation: slideInInfo 0.6s ease-out;
}

/* 🧠 Status da Memória de RPS 🧠 */
.rps-memory-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 16px;
    background: rgba(37, 99, 235, 0.03);
    border-radius: 10px;
    border: 1px dashed rgba(37, 99, 235, 0.2);
    font-size: 0.85rem;
    color: #475569;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rps-memory-info.active {
    border-style: solid;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
    transform: scale(1.02);
}

.rps-memory-info b {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.1rem;
    padding: 0 4px;
}

.rps-memory-info span {
    line-height: 1.4;
}

.rps-memory-info.hidden {
    display: none;
}

/* ════════════════════════════════════════════════════════════════
   Preview Drawer — Overlay + Painel Lateral
   ════════════════════════════════════════════════════════════════ */

.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    z-index: 900;
    animation: fadeIn 0.25s ease;
}

.preview-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 680px;
    max-width: 96vw;
    background: #fff;
    box-shadow: -8px 0 48px rgba(0, 0, 0, 0.18);
    z-index: 950;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

.preview-drawer.open {
    transform: translateX(0);
}

/* Cabeçalho do drawer */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
}

.drawer-title-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.drawer-title-wrap > i {
    font-size: 1.6rem;
    color: #60a5fa;
    flex-shrink: 0;
}

.drawer-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.drawer-subtitle {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
    font-family: 'Inter', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 380px;
}

.drawer-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.drawer-close:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* Navegação entre RPS */
.drawer-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-nav-btn {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}

.drawer-nav-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.drawer-nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.drawer-counter {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 0 4px;
    flex: 1;
    text-align: center;
}

.drawer-print-btn {
    margin-left: auto;
    padding: 6px 16px !important;
    font-size: 0.85rem !important;
}

/* Loading */
.drawer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 16px;
    color: var(--text-muted);
}

/* Área de conteúdo scrollável */
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ════════════════════════════════════════════════════════════════
   Layout da NFS-e Visual
   ════════════════════════════════════════════════════════════════ */

.nfse-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    flex-shrink: 0; /* CRÍTICO: impede que o flex container encolha as seções e corte o conteúdo */
}

.nfse-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.nfse-section-header i {
    font-size: 0.9rem;
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.nfse-section-header span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.nfse-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.nfse-field {
    padding: 12px 18px;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
}

.nfse-field:nth-child(even) {
    border-right: none;
}

.nfse-field:last-child,
.nfse-field:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
}

.nfse-field.full-width {
    grid-column: 1 / -1;
    border-right: none;
}

.nfse-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.nfse-field .field-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    white-space: normal;
}

.nfse-field .field-value.monospace {
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
}

.nfse-field .field-value.discriminacao {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Badges de status */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.green  { background: #dcfce7; color: #15803d; }
.status-badge.blue   { background: #dbeafe; color: #1d4ed8; }
.status-badge.yellow { background: #fef9c3; color: #a16207; }
.status-badge.red    { background: #fee2e2; color: #b91c1c; }
.status-badge.gray   { background: #f1f5f9; color: #475569; }

/* Totalizador de valores */
.nfse-total {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    border-radius: 12px;
    padding: 20px 24px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
    flex-shrink: 0; /* impede encolhimento no flex column */
}

.nfse-total .total-label {
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 500;
}

.nfse-total .total-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: right;
}

/* Label "Bruto: R$ X" exibido abaixo do título quando ISS é retido */
.total-bruto-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.65;
    margin-top: 4px;
    font-weight: 400;
}

/* Badge "ISS Retido" dentro do total-value */
.total-iss-badge {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(255,255,255,0.22);
    border-radius: 999px;
    padding: 2px 8px;
    margin-top: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Discriminação do serviço — bloco dedicado com scroll */
.nfse-discriminacao-block {
    padding: 14px 18px;
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    max-height: 140px;
    overflow-y: auto;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

/* Valor Líquido em destaque na seção de Valores Fiscais */
.nfse-field .field-value.valor-liquido {
    color: #16a34a;
    font-weight: 700;
    font-size: 1rem;
}

/* Sem tomador */
.nfse-empty {
    padding: 16px 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Botão visualizar na tabela do histórico */
.btn-preview {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

.btn-preview:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Print ───────────────────────────────────────────────────────── */
@page {
    size: A4 portrait;
    margin: 1.8cm 1.5cm 1.8cm 1.5cm;
}

@media print {
    /* Esconde tudo exceto o drawer */
    body > *:not(#preview-drawer) { display: none !important; }
    body { background: #fff !important; }
    * { box-shadow: none !important; text-shadow: none !important; }

    /* Drawer: expande para a página toda */
    .preview-drawer {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        border-radius: 0 !important;
        transform: none !important;
        border: none !important;
        background: #fff !important;
    }

    /* Esconde controles de UI */
    .drawer-overlay,
    .drawer-header,
    .drawer-nav,
    .drawer-loading { display: none !important; }

    /* Área de conteúdo: muda de flex para block */
    .drawer-content {
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        padding: 0 !important;
        gap: 0 !important;
        flex: none !important;
    }

    /* Cabeçalho do documento impresso */
    .drawer-content::before {
        content: "Nota Fiscal de Serviço Eletrônica — NFS-e";
        display: block;
        text-align: center;
        font-size: 13pt;
        font-weight: 700;
        color: #1e3a8a;
        letter-spacing: 0.01em;
        padding-bottom: 10pt;
        border-bottom: 2pt solid #1e3a8a;
        margin-bottom: 14pt;
        font-family: 'Inter', Arial, sans-serif;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Card de totais */
    .nfse-total {
        background: #1e3a8a !important;
        color: #fff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        border-radius: 6px !important;
        padding: 12pt 16pt !important;
        margin-bottom: 10pt !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        flex-shrink: unset !important;
    }

    .nfse-total .total-label { font-size: 9pt !important; opacity: 0.85; }
    .nfse-total .total-value { font-size: 18pt !important; font-weight: 800; text-align: right; }
    .total-bruto-label { font-size: 7.5pt !important; opacity: 0.65; display: block; }
    .total-iss-badge {
        background: rgba(255,255,255,0.25) !important;
        font-size: 6.5pt !important;
        display: inline-block !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Seções: nunca quebrar no meio */
    .nfse-section {
        border: 1pt solid #d1d5db !important;
        border-radius: 5px !important;
        margin-bottom: 8pt !important;
        overflow: visible !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        flex-shrink: unset !important;
    }

    .nfse-section-header {
        background: #f1f5f9 !important;
        color: #1e3a8a !important;
        font-size: 7.5pt !important;
        padding: 7pt 12pt !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .nfse-section-header i { display: none !important; } /* Ícones não imprimem bem */

    /* Grid de campos */
    .nfse-fields {
        padding: 8pt 12pt 10pt !important;
        gap: 8pt !important;
        grid-template-columns: repeat(2, 1fr);
    }

    .nfse-field label {
        font-size: 6.5pt !important;
        color: #6b7280 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em;
        margin-bottom: 1pt !important;
    }

    .nfse-field .field-value {
        font-size: 9pt !important;
        color: #111 !important;
        white-space: normal !important;
        word-break: break-word;
    }

    .nfse-field .field-value.monospace {
        font-size: 8.5pt !important;
        letter-spacing: 0.03em;
    }

    /* Valor líquido em verde */
    .nfse-field .field-value.valor-liquido {
        color: #166534 !important;
        font-size: 10pt !important;
        font-weight: 700;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Discriminação: remove scroll, exibe tudo */
    .nfse-discriminacao-block {
        max-height: none !important;
        overflow: visible !important;
        font-size: 8pt !important;
        padding: 10pt 12pt !important;
        color: #374151 !important;
        border-top: 1pt solid #e5e7eb !important;
        background: #f9fafb !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Badges de status */
    .status-badge, .exig-badge {
        font-size: 7pt !important;
        padding: 2pt 6pt !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .status-badge.green { background: #dcfce7 !important; color: #166534 !important; }
    .status-badge.red   { background: #fee2e2 !important; color: #991b1b !important; }
    .status-badge.gray  { background: #f1f5f9 !important; color: #374151 !important; }
    .exig-badge.green   { background: #dcfce7 !important; color: #166534 !important; }
    .exig-badge.yellow  { background: #fef9c3 !important; color: #854d0e !important; }

    /* Vazio */
    .nfse-empty { font-size: 8pt !important; padding: 8pt 12pt !important; }

    /* Rodapé automático via CSS counter */
    .drawer-content::after {
        content: "Gerado por AutoConvert · lucastecnologia3.websiteseguro.com/conversor";
        display: block;
        text-align: center;
        font-size: 7pt;
        color: #9ca3af;
        margin-top: 18pt;
        padding-top: 8pt;
        border-top: 1pt solid #e5e7eb;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ── Mobile / Tablet ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .preview-drawer {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }

    .drawer-content {
        padding: 16px;
    }

    .nfse-total {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nfse-total .total-value {
        font-size: 1.3rem;
        text-align: left;
    }

    .drawer-subtitle {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ── Login Page ─────────────────────────────────────────────────── */
.login-page {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b1120;
    overflow: hidden;
    position: relative;
}

/* Background Blobs (Mantidos) */
.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: 0;
    animation: blob-move 20s infinite alternate ease-in-out;
}

.blob-1 { width: 600px; height: 600px; background: #3b82f6; top: -100px; left: -100px; }
.blob-2 { width: 500px; height: 500px; background: #10b981; bottom: -100px; right: -100px; animation-delay: -5s; }
.blob-3 { width: 400px; height: 400px; background: #8b5cf6; top: 50%; left: 50%; transform: translate(-50%, -50%); animation-delay: -10s; }

@keyframes blob-move {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 48px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10;
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    margin: 0 auto 16px;
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
}

.login-logo h2 {
    color: #ffffff;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.login-logo p {
    color: #94a3b8;
    margin-top: 8px;
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap .input-icon-left {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.password-toggle-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    outline: none;
    transition: color 0.3s;
}

.password-toggle-btn:hover {
    color: var(--primary);
}

.login-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 12px 42px 12px 42px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-input:focus {
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn-login {
    margin-top: 10px;
    padding: 14px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
}

.btn-tour-public {
    border-radius: 8px !important;
    font-weight: 500 !important;
}

/* Sidebar Logout */
.nav-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* ── User Management ─────────────────────────────────────────────── */
/* ── User Management (Premium Design) ─────────────────────────────────── */
.user-management-wrapper {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 32px;
    align-items: flex-start;
}

@media (max-width: 1024px) {
    .user-management-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Card Style */
.users-dashboard-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), 
                0 4px 12px rgba(0, 0, 0, 0.02);
    padding: 40px;
    width: 100%;
    max-width: 1200px;
}

.users-list-container {
    overflow-x: auto;
}

.new-user-form-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    position: sticky;
    top: 32px;
}

.new-user-form-card h3 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

.new-user-form-card h3 i {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.vertical-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding-left: 4px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #f8fafc;
}

.input-with-icon input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.input-with-icon input:focus + i {
    color: var(--primary);
}

/* Permissions Selection Grid */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.permission-item {
    cursor: pointer;
    position: relative;
}

.permission-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.permission-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 110px; /* Garante altura igual para todos */
}

.permission-card i {
    font-size: 1.4rem; /* Um pouco maior */
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.permission-card span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.permission-item:hover .permission-card {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.permission-item input:checked + .permission-card {
    background: #eff6ff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.05);
}

.permission-item input:checked + .permission-card i {
    color: var(--primary);
    transform: scale(1.1);
}

.permission-item input:checked + .permission-card span {
    color: var(--primary);
}

/* Botões de Ação na Tabela */
.btn-icon-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-secondary:hover {
    background: #e2e8f0;
    color: var(--primary);
    border-color: var(--primary);
}

/* Tabela de Usuários Premium */
.users-list-container {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: #f8fafc;
    padding: 16px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.users-table td {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-main);
}

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

.users-table tr:hover td {
    background: #fcfdfe;
}

/* Badges Dinâmicos */
.badge-role {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-role.admin {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-role.user, .badge-role.financeiro {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-role.atendimento {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Back to Hub Nav */
.nav-back-hub a {
    color: var(--primary) !important;
    font-weight: 700 !important;
}

.nav-back-hub:hover a {
    background: rgba(37, 99, 235, 0.1) !important;
}

/* Botões de Ação na Tabela */
.action-group {
    display: flex;
    gap: 8px;
}

.btn-icon-danger {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #fee2e2;
    background: #fff;
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-danger:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.3;
}



/* 🎓 Sistema de Onboarding Interativo (Tour) 🎓 */

/* Overlay com Spotlight */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0); /* Transparente, o spotlight é feito com shadow */
    z-index: 9000;
    pointer-events: auto;
    transition: all 0.4s ease;
}

/* O "furo" de luz é simulado com uma sombra gigante em um elemento invisível */
.tour-spotlight {
    position: absolute;
    width: 0;
    height: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.75); /* Azul escuro semi-transparente */
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 9001;
}

/* Card de Instrução Glassmorphism */
.tour-card {
    position: absolute;
    width: 320px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 9002;
    transform-origin: center;
    animation: tourPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tourPop {
    0% { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-card h4 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tour-card h4 i {
    background: var(--primary);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.tour-card p {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tour-progress {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.tour-btns {
    display: flex;
    gap: 8px;
}

.btn-tour-skip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tour-skip:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-tour-next {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-tour-next:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* Botão Flutuante de Ajuda (FAB) */
.help-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
    z-index: 5000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    outline: none;
}

.help-fab:hover {
    background: #1d4ed8;
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.45);
}

.help-fab i {
    animation: pulseIcon 2s infinite;
}

@keyframes pulseIcon {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Responsividade para o Tour */
@media (max-width: 640px) {
    .tour-card {
        width: 280px;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* ── Ajuda Contextual por Tela ────────────────────────────────────────── */

/* Barra de ajuda no topo do upload-card */
.view-help-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

/* Botão "? Ajuda" contextual */
.btn-ctx-help {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.btn-ctx-help i {
    font-size: 0.95rem;
}

.btn-ctx-help:hover {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08); /* Fundo azul muito suave (8% opacidade) */
}

/* ── History Toolbar & Pagination ── */
.history-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.history-toolbar .input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.history-toolbar .input-group i.fa-search {
    position: absolute;
    left: 12px;
    color: #94a3b8;
    pointer-events: none;
}

.history-toolbar input {
    width: 100%;
    padding: 10px 12px;
    /* Ajuste de comp se for o campo texto de search pra n encavalar i */
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.6);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.history-toolbar input[type="text"] {
    padding-left: 36px;
}

.history-toolbar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
}

.pagination-controls .pagination-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════════════
   RESPONSIVIDADE COMPLETA — Mobile-first Media Queries
   ════════════════════════════════════════════════════════════════════════ */

/* Hamburger Button — escondido no desktop */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Sidebar Overlay — escondido no desktop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── Breakpoint: ≤ 1024px — Desktop pequeno / Tablet Landscape ────── */
@media (max-width: 1024px) {
    .top-header {
        padding: 24px 32px;
    }

    .content-wrapper {
        padding: 32px;
    }

    .upload-card {
        padding: 36px;
    }

    .users-dashboard-card {
        padding: 28px;
    }
}

/* ── Breakpoint: ≤ 768px — Tablet / Mobile ────────────────────────── */
@media (max-width: 768px) {
    /* Sidebar: fixa, escondida, slide-in */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3);
    }

    /* Hamburger: visível */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Header ajustado */
    .top-header {
        padding: 16px 20px;
        gap: 12px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    /* Content area */
    .content-wrapper {
        padding: 20px;
    }

    .ronda-active .content-wrapper {
        padding: 12px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    /* Upload card */
    .upload-card {
        padding: 24px;
        border-radius: 12px;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .drop-zone h3 {
        font-size: 1.1rem;
    }

    .cloud-icon {
        font-size: 2.4rem;
        margin-bottom: 16px;
    }

    /* Histórico */
    .history-card {
        padding: 16px;
        border-radius: 12px;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .history-header h2 {
        font-size: 1.2rem;
    }

    .history-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .history-header-actions .btn {
        padding: 7px 12px;
        font-size: 0.82rem;
    }

    .history-table th,
    .history-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    /* Info banner */
    .info-banner {
        flex-direction: column;
        padding: 16px;
    }

    .info-banner:hover {
        transform: none;
    }

    .rps-search-bar {
        max-width: 100%;
    }

    /* Lote override */
    .lote-override-wrapper {
        padding: 12px 14px;
    }

    /* Action buttons */
    .action-buttons {
        flex-wrap: wrap;
    }

    .action-buttons .btn {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }

    /* Modais */
    .modal-box {
        padding: 28px 24px;
        max-width: 92vw;
    }

    .modal-box h3 {
        font-size: 1.2rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Toasts */
    .toast-container {
        right: 16px;
        left: 16px;
        bottom: 80px;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }

    /* User management */
    .users-dashboard-card {
        padding: 20px;
        border-radius: 16px;
    }

    .users-list-container {
        overflow-x: auto;
    }

    .new-user-form-card {
        padding: 24px;
        position: static;
    }

    .users-table th,
    .users-table td {
        padding: 14px 16px;
        font-size: 0.88rem;
    }

    /* Login */
    .login-card {
        padding: 36px 28px;
        max-width: 92vw;
    }

    .login-logo h2 {
        font-size: 1.5rem;
    }

    /* NFS-e Preview fields */
    .nfse-fields {
        grid-template-columns: 1fr;
    }

    .nfse-field:nth-child(even) {
        border-right: none;
    }

    .nfse-field {
        border-right: none;
    }

    /* Total card */
    .nfse-total {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nfse-total .total-value {
        font-size: 1.3rem;
        text-align: left;
    }

    /* Tour */
    .tour-card {
        width: 300px;
        max-width: calc(100vw - 32px);
    }

    /* Help FAB */
    .help-fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    /* SendPilot form adjustments */
    .sendpilot-active .content-wrapper {
        padding: 20px;
    }

    /* History toolbar */
    .history-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Pagination */
    .pagination-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Success warning */
    .success-warning {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        max-width: 100%;
    }
}

/* ── Breakpoint: ≤ 480px — Smartphones ────────────────────────────── */
@media (max-width: 480px) {
    .top-header {
        padding: 14px 16px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.78rem;
    }

    .content-wrapper {
        padding: 16px;
    }

    .ronda-active .content-wrapper {
        padding: 8px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    .upload-card {
        padding: 20px;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .cloud-icon {
        font-size: 2rem;
    }

    .drop-zone h3 {
        font-size: 1rem;
    }

    .helper-text {
        font-size: 0.8rem;
    }

    /* Botões */
    .btn {
        padding: 10px 16px;
        font-size: 0.88rem;
    }

    .action-buttons .btn {
        min-width: unset;
        width: 100%;
    }

    /* History card */
    .history-card {
        padding: 12px;
    }

    .history-header h2 {
        font-size: 1.05rem;
    }

    .history-table th,
    .history-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* Login mobile small */
    .login-card {
        padding: 28px 20px;
        max-width: 95vw;
        border-radius: 12px;
    }

    .login-logo .logo-icon {
        width: 46px;
        height: 46px;
        font-size: 1.2rem;
    }

    .login-logo h2 {
        font-size: 1.3rem;
    }

    .login-logo p {
        font-size: 0.85rem;
    }

    .login-input {
        padding: 11px 38px 11px 38px;
        font-size: 0.95rem;
    }

    /* Modal small */
    .modal-box {
        padding: 24px 18px;
    }

    .modal-icon {
        font-size: 2.4rem;
    }

    .modal-box h3 {
        font-size: 1.1rem;
    }

    /* Users management */
    .users-dashboard-card {
        padding: 16px;
        border-radius: 12px;
    }

    .new-user-form-card {
        padding: 20px;
        border-radius: 14px;
    }

    /* Drawer adjustments */
    .drawer-header {
        padding: 16px 20px;
    }

    .drawer-nav {
        padding: 10px 16px;
    }

    .drawer-content {
        padding: 16px;
    }

    .drawer-subtitle {
        max-width: 160px;
    }

    /* RPS memory */
    .rps-memory-info {
        flex-direction: column;
        text-align: center;
        padding: 10px 12px;
    }

    /* Empty state */
    .empty-state {
        padding: 40px 20px;
    }

    .empty-state i {
        font-size: 2rem;
    }

    /* Tour */
    .tour-card {
        width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px !important;
        transform: none !important;
    }
}

/* ── Painel AutoDrive (Dashboard Google Drive) ─────────────────────────── */
.drive-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    padding: 32px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.drive-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
    margin-top: 10px;
}

.kpi-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kpi-icon.status-conn { background: #e0f2fe; color: #0284c7; }
.kpi-icon.status-pending { background: #fef3c7; color: #d97706; }
.kpi-icon.status-processed { background: #dcfce7; color: #15803d; }
.kpi-icon.status-ceps { background: #f3e8ff; color: #7e22ce; }

.kpi-details {
    display: flex;
    flex-direction: column;
}

.kpi-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-size: 1.2rem;
    color: var(--text-main);
    font-weight: 700;
    margin-top: 4px;
}

/* Control Box */
.drive-control-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.control-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drive-folder-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.drive-folder-info i {
    font-size: 1.3rem;
    color: #0f9d58; /* Google Drive Green */
}

.drive-folder-info strong {
    color: var(--text-main);
}

.drive-folder-info span {
    color: #475569;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    background: #e2e8f0;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    word-break: break-all;
}

.drive-last-sync {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-sync {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Badges for Sync */
.badge-sync {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sync.imported {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-sync.converted {
    background: #dcfce7;
    color: #15803d;
}

.badge-sync.failed {
    background: #fee2e2;
    color: #b91c1c;
}

/* Spinner Animation on Sync */
@keyframes spin-sync {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-sync.loading i {
    animation: spin-sync 1s linear infinite;
}

/* Media Queries for Drive Dashboard */
@media (max-width: 1024px) {
    .drive-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
    
    .drive-control-box {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 16px;
    }
    
    .btn-sync {
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .drive-card {
        padding: 20px;
    }
    
    .control-actions-wrap {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px !important;
    }
    
    .control-actions-wrap .btn {
        width: 100%;
        justify-content: center;
    }
    
    #drive-settings-btn {
        padding: 12px !important;
    }
}

/* ── Console de Logs do AutoDrive ───────────────────────────────────────── */
.drive-logs-section {
    margin-top: 2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.drive-logs-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #1e293b;
    border: none;
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.drive-logs-toggle:hover {
    background: #334155;
}

.drive-logs-toggle .toggle-icon {
    font-size: 0.85rem;
    color: #94a3b8;
}

.drive-logs-toggle.open .toggle-icon {
    transform: rotate(180deg);
}

.drive-logs-content {
    background: #0f172a;
    padding: 16px 20px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #e2e8f0;
    border-top: 1px solid #334155;
}

.drive-logs-content.hidden {
    display: none;
}

.log-line {
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
}

.log-line code {
    color: #64748b;
    margin-right: 10px;
    flex-shrink: 0;
}

.log-info {
    color: #38bdf8;
}

.log-success {
    color: #4ade80;
}

.log-error {
    color: #f87171;
}

/* ── Ajustes do Quick Fix e Botões extras ──────────────────────────────── */
.btn-fix {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fca5a5;
    transition: all 0.2s ease;
}

.btn-fix:hover {
    background: #fecaca;
    color: #dc2626;
    border-color: #f87171;
}

.drive-control-box .btn-secondary:hover {
    background: #cbd5e1 !important;
}

#drive-settings-btn:hover {
    background: #cbd5e1 !important;
}

.drive-fix-modal-box {
    max-width: 500px;
    text-align: left;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
}

.drive-settings-drawer {
    width: 400px;
    max-width: 100vw;
    z-index: 10000;
}

@media (max-width: 768px) {
    .drive-fix-modal-box {
        padding: 24px;
    }
}

/* ── Analytics Financeiro (Chart.js Containers) ─────────────────────────── */
.drive-analytics-section {
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.drive-analytics-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(37, 99, 235, 0.06);
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.drive-analytics-toggle:hover {
    background: rgba(37, 99, 235, 0.12);
}

.drive-analytics-toggle.open .toggle-icon {
    transform: rotate(180deg);
}

.analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
}

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

.chart-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.chart-card h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 220px;
    width: 100%;
}

.drawer-pdf-btn {
    margin-left: 8px;
    padding: 6px 16px !important;
    font-size: 0.85rem !important;
}

/* ── PDF Template Oficial (Espelho NFS-e) ───────────────────────────────── */
.pdf-invoice-template {
    font-family: 'Inter', Arial, sans-serif;
    color: #1e293b;
    padding: 24px;
    background: #fff;
    line-height: 1.4;
    font-size: 10px;
}

.pdf-header {
    display: flex;
    align-items: center;
    border: 1px solid #64748b;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 6px;
}

.pdf-header-logo {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #2563eb;
    margin-right: 12px;
    border-right: 1px solid #e2e8f0;
    padding-right: 12px;
}

.pdf-header-title {
    flex: 1;
    text-align: center;
}

.pdf-header-title h1 {
    font-size: 11px;
    font-weight: 700;
    margin: 0 0 3px 0;
    text-transform: uppercase;
    color: #0f172a;
}

.pdf-header-title p {
    margin: 0;
    font-size: 8.5px;
    color: #475569;
}

.pdf-header-meta {
    border-left: 1px solid #e2e8f0;
    padding-left: 12px;
    width: 130px;
    text-align: right;
}

.pdf-header-meta div {
    font-size: 8px;
    color: #64748b;
}

.pdf-header-meta .pdf-number {
    font-size: 13px;
    font-weight: 700;
    color: #ef4444;
    margin-top: 3px;
}

.pdf-block {
    border: 1px solid #64748b;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}

.pdf-block-title {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 8px;
    color: #475569;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 3px;
    margin-bottom: 8px;
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
}

.pdf-field {
    display: flex;
    flex-direction: column;
}

.pdf-field label {
    font-size: 7.5px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 1px;
}

.pdf-field span {
    font-size: 9.5px;
    font-weight: 500;
    color: #0f172a;
}

.pdf-service-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #64748b;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.pdf-service-table th {
    background: #f8fafc;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 8px;
    color: #475569;
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid #64748b;
}

.pdf-service-table td {
    padding: 10px;
    font-size: 9px;
    color: #334155;
    vertical-align: top;
}

.pdf-disc {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 8.5px;
    line-height: 1.4;
    color: #1e293b;
}

.pdf-values-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #64748b;
    border: 1px solid #64748b;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.pdf-value-box {
    background: #fff;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
}

.pdf-value-box.highlight {
    background: #f0f9ff;
}

.pdf-value-box label {
    font-size: 7px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 1px;
}

.pdf-value-box span {
    font-size: 10px;
    font-weight: 700;
    color: #0f172a;
}

.pdf-footer {
    text-align: center;
    font-size: 7.5px;
    color: #94a3b8;
    margin-top: 16px;
    border-top: 1px solid #e2e8f0;
    padding-top: 6px;
}

/* --- HUB & SHARED CARDS CSS --- */
.hub-container {
    max-width: 1200px;
    margin: 80px auto;
    padding: 0 40px;
    animation: fadeInHub 0.6s ease-out;
}

@keyframes fadeInHub {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hub-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}

.hub-header {
    text-align: center;
    margin-bottom: 80px;
}

.hub-header h1 {
    font-size: 3.2rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

.hub-header p {
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* Row Layout for Horizontal Cards */
.hub-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 30px;
    flex-wrap: nowrap; /* Forces them to stay side-by-side */
}

@media (max-width: 1024px) {
    .hub-row {
        flex-wrap: wrap; /* Wraps only on smaller screens */
    }
}

.hub-card-horizontal {
    flex: 1;
    min-width: 320px;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 30px;
    text-decoration: none;
    display: flex;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}

.hub-card-horizontal:hover {
    transform: translateY(-2px);
    background: #ffffff;
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.08);
    border-color: var(--primary);
}

.hub-card-horizontal__icon {
    width: 60px;
    height: 60px;
    min-width: 60px;
    background: var(--primary);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
    transition: transform 0.4s ease;
}

.hub-card-horizontal__icon.pilot {
    background: #0ea5e9;
    box-shadow: 0 8px 16px rgba(14, 165, 233, 0.25);
}

.hub-card-horizontal__icon.mestre {
    background: #f59e0b;
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.25);
}

.hub-card-horizontal:hover .hub-card-horizontal__icon {
    transform: scale(1.1) rotate(-5deg);
}

.hub-card-horizontal__content {
    display: flex;
    flex-direction: column;
}

.hub-tag {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    width: fit-content;
}

.hub-tag.financeiro { background: #dcfce7; color: #166534; }
.hub-tag.atendimento { background: #e0f2fe; color: #075985; }
.hub-tag.admin { background: #fef3c7; color: #92400e; }

.hub-card-horizontal h3 {
    font-size: 1.3rem;
    font-weight: 750;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.hub-card-horizontal p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.hub-card-horizontal__action {
    margin-top: auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.3s ease;
}

.hub-card-horizontal:hover .hub-card-horizontal__action {
    gap: 10px;
}

/* Locked Card Styles */
.hub-card-horizontal.locked {
    filter: grayscale(100%);
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(200, 200, 200, 0.1);
    box-shadow: none;
    border-color: rgba(0,0,0,0.05);
}

.hub-card-horizontal.locked:hover {
    transform: none;
    background: rgba(200, 200, 200, 0.15);
    box-shadow: none;
}

.hub-card-horizontal.locked .hub-card-horizontal__icon {
    background: #9ca3af !important;
    box-shadow: none !important;
}

.hub-card-horizontal.locked:hover .hub-card-horizontal__icon {
    transform: none;
}

.hub-card-horizontal.locked .hub-tag {
    background: #e5e7eb !important;
    color: #6b7280 !important;
}

.hub-card-horizontal.locked .hub-card-horizontal__action {
    color: #9ca3af;
}

/* ==========================================================================
   💎 PREMIUM SAAS THEME REFINEMENT (PORTAL ESA)
   ========================================================================== */

/* Redefinição de variáveis para paleta moderna de alta fidelidade (Indigo/Slate) */
:root {
    --primary: #4f46e5 !important; /* Indigo vibrante */
    --primary-hover: #4338ca !important;
    --primary-rgb: 79, 70, 229 !important;
    --bg-main: #f8fafc !important; /* Slate claro extremamente limpo */
    --bg-card: #ffffff !important;
    --text-main: #0f172a !important;
    --text-muted: #64748b !important;
    --success: #10b981 !important;
    --error: #f43f5e !important; /* Tom Rose moderno para erros */
    --sidebar-bg: #0b0f19 !important; /* Dark Space Navy super premium */
    --sidebar-text: #94a3b8 !important;
    --sidebar-active: #1e293b !important;
    --border: #e2e8f0 !important;
    
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.03), 0 4px 12px -2px rgba(0, 0, 0, 0.015) !important;
    --hover-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.08), 0 10px 20px -5px rgba(0, 0, 0, 0.02) !important;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Scrollbar premium global */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Typography polish */
h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.02em !important;
}

/* Sidebar elegante estilo Pill Flutuante */
.sidebar {
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.04) !important;
    padding: 24px 16px !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05) !important;
}

.logo {
    padding: 12px 16px 32px 16px !important;
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    color: #fff !important;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), #818cf8) !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4) !important;
}

.nav-links {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.nav-links li a {
    padding: 12px 16px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    transition: var(--transition-smooth) !important;
}

.nav-links li:hover a {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: #fff !important;
}

.nav-links li.active a {
    background: linear-gradient(135deg, var(--primary), #818cf8) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3) !important;
    border-left: none !important; /* Remove borda dura antiga */
}

/* Cartões com cantos super suaves e bordas finas */
.upload-card, .history-card, .users-dashboard-card, .new-user-form-card, .drive-card {
    border-radius: 24px !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: var(--card-shadow) !important;
    transition: var(--transition-smooth) !important;
}

.upload-card:hover, .history-card:hover, .users-dashboard-card:hover, .new-user-form-card:hover, .drive-card:hover {
    box-shadow: var(--hover-shadow) !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
}

/* Área de Drop Zone refinada */
.drop-zone {
    border: 2px dashed rgba(99, 102, 241, 0.25) !important;
    border-radius: 20px !important;
    background-color: #fafbfc !important;
    transition: var(--transition-smooth) !important;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary) !important;
    background-color: rgba(99, 102, 241, 0.04) !important;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.1) !important;
}

/* Botões modernos com gradiente e transições suaves */
.btn {
    border-radius: 12px !important;
    font-size: 0.95rem !important;
    transition: var(--transition-smooth) !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary)) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35) !important;
}

.btn-secondary {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid var(--border) !important;
}

.btn-secondary:hover {
    background: #e2e8f0 !important;
    color: var(--text-main) !important;
}

/* Inputs globais estilizados */
.input-with-icon input, .form-control, .login-input {
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    transition: var(--transition-smooth) !important;
}

.input-with-icon input:focus, .form-control:focus, .login-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15) !important;
}

/* Tabelas limpas e sofisticadas */
.history-table {
    border-collapse: separate !important;
    border-spacing: 0 4px !important;
}

.history-table th {
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--text-muted) !important;
    font-weight: 700 !important;
    padding: 12px 16px !important;
    border-bottom: 2px solid var(--border) !important;
}

.history-table td {
    padding: 14px 16px !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5) !important;
}

.history-table tr:hover td {
    background-color: #fafbfc !important;
}

/* Modal Box refinado */
.modal-box {
    border-radius: 24px !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.15) !important;
}

/* --- USER ROLE BADGES --- */
.user-info-mini {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
}

.role-badge {
    display: inline-block !important;
    padding: 2px 8px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    border-radius: 6px !important;
    letter-spacing: 0.05em !important;
}

.role-badge.admin {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.role-badge.financeiro {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
}

.role-badge.atendimento {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
}

.role-badge.portaria {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
}

/* == Hub: Responsividade Mobile == */
@media (max-width: 768px) {
    .hub-container { margin: 24px auto !important; padding: 0 20px !important; }
    .hub-header { margin-bottom: 32px !important; }
    .hub-header img { height: 64px !important; margin-bottom: 14px !important; }
    .hub-badge { margin-bottom: 14px !important; font-size: 0.65rem !important; }
    .hub-header h1 { font-size: 2rem !important; margin-bottom: 8px !important; }
    .hub-header p { font-size: 1rem !important; }
    .hub-row { flex-direction: column !important; gap: 12px !important; align-items: stretch !important; }
    .hub-card-horizontal { min-width: unset !important; max-width: 100% !important; width: 100% !important; flex: none !important; padding: 20px !important; border-radius: 18px !important; }
}

@media (max-width: 480px) {
    .hub-container { margin: 16px auto !important; padding: 0 16px !important; }
    .hub-header { margin-bottom: 20px !important; }
    .hub-header img { height: 52px !important; margin-bottom: 10px !important; }
    .hub-header h1 { font-size: 1.65rem !important; margin-bottom: 6px !important; }
    .hub-header p { font-size: 0.9rem !important; }
    .hub-row { gap: 10px !important; }
    .hub-card-horizontal { padding: 16px !important; gap: 14px !important; border-radius: 16px !important; }
    .hub-card-horizontal__icon { width: 48px !important; height: 48px !important; min-width: 48px !important; font-size: 1.2rem !important; border-radius: 12px !important; }
    .hub-card-horizontal h3 { font-size: 1.05rem !important; margin-bottom: 4px !important; }
    .hub-card-horizontal p { font-size: 0.82rem !important; margin-bottom: 12px !important; }
}
