/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
    margin: 0;
    padding: 0;
}

/* Top Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 2px solid #EE7736;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.top-header-content {
    width: 100%;
    max-width: 100%;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-header-logo {
    display: flex;
    align-items: center;
}

.logo-top {
    height: 45px;
    max-width: 250px;
    object-fit: contain;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.last-update {
    background-color: #00A859;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.btn-options {
    background: white;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-options:hover {
    background-color: #f5f5f5;
}

/* App Layout */
.app-layout {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 2px solid #EE7736;
    position: fixed;
    top: 60px;
    left: 0;
    z-index: 900;
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 1.5rem 0;
}

.sidebar-welcome {
    padding: 0 1.5rem 1.5rem 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 1rem;
}

.sidebar-welcome p {
    color: #333;
    font-size: 0.9rem;
    margin: 0;
}

.sidebar-welcome strong {
    color: #333;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.nav-item:hover {
    background-color: #f5f5f5;
}

.nav-item.active {
    background-color: #00A859;
    color: white;
}

.nav-item.active .nav-icon {
    color: white;
}

.nav-item.nav-logout {
    margin-top: auto;
    color: #dc3545;
}

.nav-item.nav-logout:hover {
    background-color: #f8d7da;
    color: #dc3545;
}

.nav-item.nav-logout .nav-icon {
    color: #dc3545;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #666;
}

.nav-item.active .nav-icon {
    color: white;
}

.nav-item span {
    flex: 1;
}

/* Nav Groups */
.nav-group {
    margin-bottom: 0.25rem;
}

.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.8rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.nav-group-toggle:hover {
    background-color: #f5f5f5;
}

.nav-group-toggle span {
    flex: 1;
}

.nav-group-arrow {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #666;
    transition: transform 0.3s ease;
}

.nav-group.expanded .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.expanded .nav-group-content {
    max-height: 2000px;
}

.nav-subitem {
    padding-left: 2.5rem !important;
    font-size: 0.8rem;
}

.nav-subitem .nav-icon {
    width: 14px;
    height: 14px;
}

.nav-group:has(.nav-item.active) .nav-group-toggle {
    background-color: #f0f9f4;
    color: #00A859;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 1rem;
    background-color: #f5f5f5;
    min-height: calc(100vh - 60px);
}

/* Container */
.container {
    max-width: 100%;
    padding: 0;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f5f5f5;
    padding: 2rem 1rem;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 1rem;
}

.login-box {
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

.login-box::before {
    content: '';
    display: block;
    width: 100%;
    height: 6px;
    background: #EE7736;
    position: absolute;
    top: 0;
    left: 0;
}

.login-logo {
    text-align: center;
    padding: 2rem 2rem 1rem 2rem;
    margin-bottom: 0;
}

.logo-img-login {
    height: 70px;
    max-width: 280px;
    object-fit: contain;
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin: 0 2rem 0.5rem 2rem;
    font-size: 1.75rem;
    font-weight: bold;
}

.login-box h2 {
    text-align: center;
    color: #666;
    font-size: 1rem;
    font-weight: normal;
    margin: 0 2rem 2rem 2rem;
}

.login-form {
    padding: 0 2rem 2rem 2rem;
}

.login-form .alert {
    margin-bottom: 1.5rem;
    padding: 0.875rem;
    border-radius: 6px;
}

.login-box .form-group {
    margin-bottom: 1.5rem;
}

.form-label-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-icon {
    color: #666;
    flex-shrink: 0;
}

.login-input {
    width: 100%;
    padding: 0.75rem;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
}

.login-input:focus {
    outline: none;
    border-color: #00A859;
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.btn-login {
    width: 100%;
    background-color: #00A859;
    color: white;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
    margin-top: 1.5rem;
}

.btn-login:hover {
    background-color: #008045;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 168, 89, 0.2);
}

.btn-login svg {
    flex-shrink: 0;
}

.login-info {
    margin-top: 1.5rem;
    padding: 0 2rem 2rem 2rem;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
}


/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 400;
    line-height: 1.5;
    vertical-align: middle;
    transition: all 0.3s;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-primary {
    background-color: #00A859;
    color: white;
}

.btn-primary:hover {
    background-color: #008045;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-danger[style*="opacity"] {
    position: relative;
}

/* Tooltip customizado */
.custom-tooltip {
    position: fixed;
    background-color: #333;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: normal;
    max-width: 300px;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    word-wrap: break-word;
    line-height: 1.4;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-link {
    background: none;
    color: #00A859;
    text-decoration: underline;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* Forms */
.form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00A859;
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* Tables */
.table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table thead {
    background-color: #EE7736;
    color: white;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tfoot {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Editor de NFs (inputs dentro de tabela/modal) */
.nf-editor input.nf-nf,
.nf-editor input.nf-emissao,
.nf-editor input.nf-valor,
.nf-editor input.nf-quitacao,
.nf-editor input.nf-liberacao,
.nf-editor select.nf-pago {
    padding: 0.45rem 0.55rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: #fff;
    color: #333;
    box-sizing: border-box;
    min-height: 34px;
}

.nf-editor input.nf-nf,
.nf-editor input.nf-emissao,
.nf-editor input.nf-quitacao,
.nf-editor input.nf-liberacao,
.nf-editor select.nf-pago {
    width: 100%;
}

.nf-editor input.nf-valor {
    text-align: right;
}

.nf-editor input.nf-nf:focus,
.nf-editor input.nf-emissao:focus,
.nf-editor input.nf-valor:focus,
.nf-editor input.nf-quitacao:focus,
.nf-editor input.nf-liberacao:focus,
.nf-editor select.nf-pago:focus {
    outline: none;
    border-color: #00A859;
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.nf-editor .table td {
    vertical-align: middle;
}

.table-info {
    width: 100%;
    background: white;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-info th {
    background-color: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    width: 200px;
    font-weight: 500;
}

.table-info td {
    padding: 0.75rem;
    border-bottom: 1px solid #ddd;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-pendente {
    background-color: #fff3cd;
    color: #856404;
}

.status-aprovada {
    background-color: #d4edda;
    color: #155724;
}

.status-cancelada {
    background-color: #f8d7da;
    color: #721c24;
}

.status-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
}

.stat-card::before {
    content: '';
    width: 36px;
    height: 36px;
    border-radius: 50%;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: #00A859;
    opacity: 0.1;
}

.stat-card.warning::before {
    background-color: #EE7736;
}

.stat-card.danger::before {
    background-color: #dc3545;
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    background-color: #00A859;
    color: white;
}

.stat-card.warning .stat-icon {
    background-color: #EE7736;
}

.stat-card.danger .stat-icon {
    background-color: #dc3545;
}

.stat-card h3 {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: bold;
    color: #333;
    margin: 0.25rem 0;
    line-height: 1;
}

.stat-card small {
    display: block;
    color: #666;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-card a {
    color: #00A859;
    text-decoration: none;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.stat-card a:hover {
    text-decoration: underline;
}

/* Sections */
.section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.section h2 {
    margin-bottom: 0.25rem;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section h2 .section-icon {
    width: 18px;
    height: 18px;
    color: #666;
}

.section .section-subtitle {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

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

.page-header h1 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h1 .page-icon {
    width: 24px;
    height: 24px;
    color: #0066cc;
}

.page-header .page-subtitle {
    color: #666;
    font-size: 0.875rem;
    font-weight: normal;
    margin-top: 0.25rem;
}

/* Filters */
.filters {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form select,
.filter-form input[type="date"],
.filter-form input[type="text"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 38px;
    box-sizing: border-box;
}

.filter-form .btn {
    min-height: 38px;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
}

.filter-form button.btn,
.filter-form a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.5rem 1rem;
    vertical-align: middle;
    line-height: 1.5;
}

.filter-form .form-group {
    display: flex;
    align-items: center;
}

/* Progress Bar */
.progress-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #00A859, #EE7736);
    transition: width 0.3s;
}

.progress-bar span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: bold;
    color: #333;
    z-index: 1;
}

/* Footer */
.footer {
    margin-left: 260px;
    background-color: white;
    color: #666;
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid #e5e5e5;
}

.footer .container {
    padding: 1rem;
}

/* Paginação */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding: 1rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

@import url('timeline.css');

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background-color: #f5f5f5;
    border-color: #00A859;
    color: #00A859;
}

.pagination-btn.active {
    background-color: #00A859;
    border-color: #00A859;
    color: white;
    font-weight: 600;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: #999;
}

/* Ordenação de colunas */
.table th {
    position: relative;
    user-select: none;
}

.table th.sortable {
    cursor: pointer;
    padding-right: 24px;
}

.table th.sortable:hover {
    background-color: #f8f9fa;
}

.table thead th.sortable:hover {
    background-color: #d65a1f;
}

.sort-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.table th.sortable:hover .sort-icon {
    opacity: 1;
}

.table th.sortable.active .sort-icon {
    opacity: 1;
    color: #00A859;
}

.sort-icon.sort-asc,
.sort-icon.sort-desc {
    opacity: 1;
    color: #00A859;
}

/* Sidebar Toggle */
.btn-sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-sidebar-toggle:hover {
    background-color: #f5f5f5;
    color: #00A859;
}

/* Sidebar Hidden State (Desktop) */
@media (min-width: 769px) {
    .sidebar {
        transition: transform 0.3s, width 0.3s;
    }

    .main-content, .footer {
        transition: margin-left 0.3s;
    }

    body.sidebar-hidden .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-hidden .main-content {
        margin-left: 0;
    }

    body.sidebar-hidden .footer {
        margin-left: 0;
    }
}

/* Sidebar Visible State (Mobile) */
@media (max-width: 768px) {
    body.sidebar-mobile-visible .sidebar {
        transform: translateX(0);
        z-index: 1001;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    }
    
    body.sidebar-mobile-visible::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .footer {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
}
