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

:root {
    --white: #FFFFFF;
    --green-primary: #8BC34A;
    --green-dark: #2E7D32;
    --gray-dark: #1F2937;
    --gray-light: #F3F4F6;
    --gray-border: #E5E7EB;
    --yellow-soft: #FFF9C4;
    --red-soft: #FFEBEE;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--white);
    color: var(--gray-dark);
    line-height: 1.5;
    overflow-x: hidden;
}

.container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--white);
    border-right: 1px solid var(--gray-border);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.3s ease, min-width 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
}

.sidebar.collapsed .logo-text > span:not(.logo-icon) {
    display: none;
}

.sidebar.collapsed .menu-link > span:not(.menu-icon) {
    display: none;
}

.sidebar.collapsed .logo {
    padding: 0 16px 32px;
    justify-content: center;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 12px;
}

.sidebar-toggle {
    position: absolute;
    top: 20px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--gray-light);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle svg {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.logo {
    padding: 0 24px 32px;
    border-bottom: 1px solid var(--gray-border);
    margin-bottom: 24px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--green-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--green-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.menu {
    list-style: none;
    padding: 0 12px;
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-dark);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.menu-link span:not(.menu-icon) {
    transition: opacity 0.3s ease;
}

.menu-link:hover {
    background: var(--gray-light);
}

.menu-link.active {
    background: var(--gray-light);
    color: var(--green-dark);
    position: relative;
}

.menu-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--green-primary);
    border-radius: 0 4px 4px 0;
}

.menu-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    background: var(--gray-light);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 80px;
    width: calc(100% - 80px);
    max-width: calc(100% - 80px);
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-border);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-dark);
    white-space: nowrap;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    min-width: 200px;
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border: 1px solid var(--gray-border);
    border-radius: 12px;
    font-size: 14px;
    background: var(--gray-light);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--green-primary);
    background: var(--white);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #9CA3AF;
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.icon-button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.icon-button:hover {
    background: var(--gray-border);
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--green-primary);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.profile:hover {
    background: var(--gray-light);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--green-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.profile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-dark);
    white-space: nowrap;
}

/* Dashboard Content */
.dashboard-content {
    padding: 32px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    width: 100%;
}

.kpi-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--gray-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

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

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.kpi-icon.green {
    background: rgba(139, 195, 74, 0.1);
    color: var(--green-dark);
}

.kpi-icon.gray {
    background: var(--gray-light);
    color: #6B7280;
}

.kpi-icon.yellow {
    background: rgba(255, 193, 7, 0.1);
    color: #F57C00;
}

.kpi-icon.red {
    background: rgba(244, 67, 54, 0.1);
    color: #C62828;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-dark);
    margin-bottom: 4px;
    word-break: break-word;
}

.kpi-value.green {
    color: var(--green-dark);
}

.kpi-subtitle {
    font-size: 13px;
    color: #6B7280;
}

/* Action Section */
.action-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    width: 100%;
}

.btn-primary {
    background: var(--green-primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(139, 195, 74, 0.2);
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--green-dark);
    box-shadow: 0 4px 8px rgba(139, 195, 74, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--gray-dark);
    border: 1px solid var(--gray-border);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--gray-light);
    border-color: var(--green-primary);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Table Section */
.table-section {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--gray-border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    overflow-x: auto;
}

.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 800px;
}

.table-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-dark);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.table thead {
    background: var(--gray-light);
}

.table th {
    padding: 16px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-border);
    white-space: nowrap;
}

.table td {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-border);
    font-size: 14px;
    white-space: nowrap;
}

.table tbody tr {
    transition: all 0.2s;
}

.table tbody tr:hover {
    background: var(--gray-light);
}

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

.company-name {
    font-weight: 600;
    color: var(--gray-dark);
}

.score {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-dark);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-risk-a {
    background: rgba(139, 195, 74, 0.15);
    color: var(--green-dark);
}

.badge-risk-b {
    background: rgba(156, 163, 175, 0.15);
    color: #4B5563;
}

.badge-risk-c {
    background: rgba(255, 193, 7, 0.15);
    color: #F57C00;
}

.badge-risk-d {
    background: rgba(244, 67, 54, 0.15);
    color: #C62828;
}

.badge-confidence-high {
    background: rgba(139, 195, 74, 0.15);
    color: var(--green-dark);
}

.badge-confidence-medium {
    background: rgba(255, 193, 7, 0.15);
    color: #F57C00;
}

.badge-confidence-low {
    background: rgba(244, 67, 54, 0.15);
    color: #C62828;
}

.decision {
    font-weight: 500;
}

.decision-approved {
    color: var(--green-dark);
}

.decision-restricted {
    color: #F57C00;
}

.decision-manual {
    color: #6366F1;
}

.decision-rejected {
    color: #C62828;
}

.value {
    font-weight: 600;
    color: var(--gray-dark);
}

.date-time {
    color: #6B7280;
    font-size: 13px;
}

.action-link {
    color: var(--green-primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-link:hover {
    color: var(--green-dark);
}

/* Insights Panel */
.insights-panel {
    width: 100%;
    max-width: 100%;
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: 16px;
    padding: 32px 24px;
    margin-top: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.insights-panel > .insights-title {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.insights-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 24px;
}

.insight-card {
    background: var(--gray-light);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 0;
}

.insight-label {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    margin-bottom: 8px;
}

.insight-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 12px;
}

.insight-chart {
    height: 60px;
    background: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 8px;
}

.chart-bar {
    flex: 1;
    background: var(--green-primary);
    border-radius: 4px 4px 0 0;
    min-height: 8px;
}

.rejection-list {
    list-style: none;
}

.rejection-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-border);
    font-size: 13px;
    color: var(--gray-dark);
}

.rejection-item:last-child {
    border-bottom: none;
}

.rejection-reason {
    font-weight: 500;
    margin-bottom: 4px;
}

.rejection-count {
    color: #6B7280;
    font-size: 12px;
}

/* SVG Icons */
.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Media Queries para Responsividade */
/* Telas médias */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 992px) {
    .header {
        padding: 16px 24px;
    }
    
    .header-left {
        gap: 16px;
    }
    
    .search-box {
        max-width: 100%;
        min-width: 200px;
    }
    
    .dashboard-content {
        padding: 24px;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 16px;
    }
    
    .kpi-value {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .header-left {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .search-box {
        width: 100%;
        max-width: 100%;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .dashboard-content {
        padding: 16px;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .action-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .table-section {
        border-radius: 12px;
    }
    
    .table-header {
        padding: 16px;
        min-width: 600px;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .insights-panel {
        padding: 20px 16px;
        margin-top: 24px;
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 12px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .profile-name {
        display: none;
    }
    
    .dashboard-content {
        padding: 12px;
    }
    
    .kpi-card {
        padding: 16px;
    }
    
    .kpi-value {
        font-size: 24px;
    }
    
    .table-header {
        padding: 12px;
        min-width: 500px;
    }
    
    .table {
        min-width: 500px;
    }
    
    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .insights-panel {
        padding: 24px 16px;
        margin-top: 24px;
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Garantir que elementos não ultrapassem limites */
* {
    max-width: 100%;
}

img, svg {
    max-width: 100%;
    height: auto;
}

