
#vendas-view {
    width: 100%;
    min-height: 100vh;
    background: #f8fafc;
}

.vendas-container {
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.vendas-header-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.25rem 1.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
}

.vendas-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.vendas-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.vendas-filter-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vendas-filter-group select,
.vendas-filter-group input {
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
}

.vendas-filter-group select:focus,
.vendas-filter-group input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.vendas-quick-dates {
    display: flex;
    gap: 6px;
    margin-bottom: 2px;
}

.vendas-quick-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.vendas-quick-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.vendas-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.vendas-kpi-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    min-height: 120px;
    box-sizing: border-box;
}

.vendas-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.vendas-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.vendas-kpi-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vendas-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vendas-kpi-icon.faturamento {
    background: #eff6ff;
    color: #2563eb;
}

.vendas-kpi-icon.cupons {
    background: #f0fdf4;
    color: #16a34a;
}

.vendas-kpi-icon.ticket {
    background: #faf5ff;
    color: #9333ea;
}

.vendas-kpi-icon.qtd {
    background: #fff7ed;
    color: #ea580c;
}

.vendas-kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0.5rem 0 0.15rem 0;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.vendas-kpi-compare-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.78rem;
}

.vendas-kpi-diff-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.76rem;
    white-space: nowrap;
    line-height: 1;
}

.vendas-kpi-diff-badge.badge-up {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.vendas-kpi-diff-badge.badge-down {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.vendas-kpi-diff-badge.badge-neutral {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.vendas-kpi-diff-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.vendas-kpi-diff-label strong {
    color: #334155;
    font-weight: 700;
}

.vendas-chart-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.vendas-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.vendas-chart-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.vendas-legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8fafc;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.vendas-legend-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 700;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.vendas-legend-btn.disabled {
    opacity: 0.4;
    background: #f1f5f9;
    text-decoration: line-through;
    box-shadow: none;
}

.vendas-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.vendas-canvas-container {
    position: relative;
    width: 100%;
    height: 420px;
}

#vendasChartCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.vendas-table-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.vendas-table-wrapper {
    overflow-x: auto;
}

.vendas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.vendas-table th {
    background: #f8fafc;
    padding: 0.85rem 1.1rem;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
}

.vendas-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease-in-out;
}

.vendas-table th.sortable:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.vendas-table th.sortable.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-bottom: 2px solid #2563eb;
}

.vendas-table th .sort-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.72rem;
    font-weight: 800;
    vertical-align: middle;
}

.vendas-table td {
    padding: 0.75rem 1.1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    font-weight: 500;
}

.tree-row {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.tree-row:hover {
    background: #f8fafc !important;
}

.tree-row.secao-row td {
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
    border-top: 1.5px solid #cbd5e1;
}

.tree-row.grupo-row td {
    background: #f8fafc;
    font-weight: 600;
    color: #1e293b;
}

.tree-row.subgrupo-row td {
    background: #ffffff;
    font-weight: 500;
    color: #334155;
}

.tree-row.produto-row td {
    background: #ffffff;
    font-size: 0.85rem;
    color: #475569;
}

.tree-row.produto-row.selected-prod-row td {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    font-weight: 700 !important;
}

.tree-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 0.75rem;
    background: #e2e8f0;
    color: #334155;
    transition: transform 0.2s;
}

.tree-row.expanded .tree-toggle-icon {
    transform: rotate(90deg);
    background: #2563eb;
    color: #ffffff;
}

.indent-lvl-1 { padding-left: 1rem !important; }
.indent-lvl-2 { padding-left: 2.5rem !important; }
.indent-lvl-3 { padding-left: 4rem !important; }
.indent-lvl-4 { padding-left: 5.5rem !important; }

.vendas-table tr.total-row td {
    font-weight: 800;
    background: #eff6ff;
    color: #1e40af;
    border-top: 2px solid #bfdbfe;
    font-size: 0.95rem;
}

.coi-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.coi-modal-card {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    border: 1px solid #cbd5e1;
    overflow: hidden;
}

.coi-modal-header {
    padding: 1.25rem 1.75rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coi-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coi-modal-header p {
    font-size: 0.82rem;
    color: #64748b;
    margin: 4px 0 0 0;
}

.coi-modal-close-btn {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.coi-modal-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.coi-modal-toolbar {
    padding: 1rem 1.75rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.coi-search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.coi-search-box input {
    width: 100%;
    padding: 0.55rem 0.9rem 0.55rem 2.2rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.88rem;
    outline: none;
}

.coi-search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.coi-pills-group {
    display: flex;
    gap: 6px;
}

.coi-pill-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.coi-pill-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.coi-modal-list {
    padding: 1rem 1.75rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coi-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.15s;
    cursor: pointer;
}

.coi-list-item:hover {
    border-color: #bfdbfe;
    background: #f0f6ff;
}

.coi-list-item.selected {
    border-color: #93c5fd;
    background: #eff6ff;
}

.coi-badge-id {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.coi-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    flex: 1;
}

.coi-checkbox-custom {
    width: 20px;
    height: 20px;
    accent-color: #2563eb;
    cursor: pointer;
}

.coi-modal-footer {
    padding: 1rem 1.75rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coi-counter-info {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2563eb;
}
